PDO and ORM in PHP


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
4 views
Before I developed all projects on the basis of the PDO DB. Now after reading a lot of books and articles began to wonder whether the approach I am using? Everywhere you go tips on using Doctrine or Propel as a more convenient means. Yes, the format for the above examples I liked. But whether these libraries to create complex queries with multiple JOINS such as AMI, and in General what impact the use of these libraries for performance?

So the question to the public: "What do You use to access the database, and why You chose this method?".
by | 4 views

7 Answers

0 like 0 dislike
Simple queries (80 percent) of ORM make it easier of course, but if you need a standard, native sql is easier to do. IMHO of course.
by
0 like 0 dislike
Also asked a similar question. Tried doctrine and sang, but threw them because a great deal of extravagance and crutches for complex queries. Also annoyed a huge number of auxiliary files (base classes, mappers, etc.) for each model generated these libraries. Eventually made my ORM on the basis of Zend_Db_Table, Zend_Select (this is especially beneficial when the project is built on ZF).
For simple cases, it is convenient to use Active Record. The most successful example of implementation of the considered AR in Yii framework.
by
0 like 0 dislike
I like the approach used in Yii framework — simple queries can be implemented using the ORM, and for complex, there is a lower level of abstraction based on PDO. Thus you can combine both approach depending on the complexity of a particular element of the project.
by
0 like 0 dislike
There is such a thing as a forum in php: www.phpclub.ru/
Where there is search, and much more experienced people (not ... (more) newbies as on Habre).
Although I sincerely hope that there will be able to tell...
by
0 like 0 dislike
Used the doctrine (in the Symphony) — comfortable, joini can do. Everything clearly and beautifully, there is documentation.
Of the minuses — it consumes a lot of memory.
by
0 like 0 dislike
Doctrine (routine) + PDO (for clinical cases) FTW
by
0 like 0 dislike
The error in understanding the difference between PDO and ORM, the question sounds like "spoon, or a bowl for dinner"
\r
PDO is a DBAL — a simple interface for working with a database, which provides the same methods for working with different data bases, so you don't need to think what kind of DB we are working in the moment.
\r
ORM — — Wikipedia, is a programming technique for converting data between incompatible type systems in object-oriented programming languages. Ie, a technique of converting ordinary tables as in a relational database into objects. It is obvious, with the usual arrays to work hard, and FETCH_OBJECT it is still not OO-poohed.
\r
One technology complements the other.
\r
Now about propel and doctrine.
\r
Doctrine 1 I did not like because it added a lot of weird features and the end result came out a mess, difficult to study (for example, three ways of retrieving data from the entity, an incomprehensible abstraction 'Table').
\r
Propel. more dead than alive. It was raised and supported right now only one person. Did not like the fact that one entity is generated 6 strange classes, and the process of generation bored
\r
Doctrine 2 is almost hibernate for php,%) compared with the first version of its cleared of debris and made it data mapper. This is intuitive interface, a clean domain objects (entities) — all the config can be put in the annotations/xml/yaml. As a result, all models look as simple as class news {private $title; private $text; }. Stopped on it.
by

Related questions

0 like 0 dislike
3 answers
asked Mar 24, 2019 by hlx
0 like 0 dislike
1 answer
asked Sep 3, 2019 by Shillkas11
0 like 0 dislike
1 answer
asked Sep 7, 2019 by Shillkas11
0 like 0 dislike
1 answer
asked Aug 11, 2019 by Shillkas11
0 like 0 dislike
1 answer
asked Aug 1, 2019 by Shillkas11
110,608 questions
257,186 answers
0 comments
26,184 users