H
H
hlx2012-02-26 19:52:09
ORM
hlx, 2012-02-26 19:52:09

Choosing PHP ORM, ActiveRecord?

Please advise on the choice of ORM Framework for PHP. I used to use Yii and Yii ActiveRecord with it, but now I need to choose a separate framework. (Doctrine, Propel and so on).
Wish it was well documented.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Anton Taraev, 2012-02-26
@ataraev

If in production, then definitely Doctrine + Symfony

D
Davert, 2012-02-27
@Davert

Propel or Propel2 is an awesome
ORM with query generation.
Oh yeah, and Doctrine2 is not ActiveRecord. Not suitable for Rapid Application Development. But if you have a complex project, then you should consider using DataMapper.

V
Vladimir Chernyshev, 2012-02-26
@VolCh

First, you probably need to evaluate ActiveRecord or DataMapper - if the latter, then Doctrine 2 seems to have no competitors, even if it is limited not only to PHP. If ActiveRecord then there are a lot of options. Including the first Doctrine - I would choose it as AR, if it weren't embarrassing that it would hardly be fully supported, and most likely there would be no development at all.
By the way, thanks for giving me a reason to check out the Doctrine website and see that they have ODM not only for Mongo, but also for Couch (albeit in alpha for now). By the way, this is another plus in the direction of Doctrine 2 - no big changes in the code are required if you want to switch to Couch or Mongo.

H
hlx, 2012-02-27
@hlx

Regarding Doctrine:
1. Do you always need to describe getters in Doctrine to get parameters? it is impossible, as in yii, for example
, to simply refer to the attribute:
echo $user->name;
echo $user->email
all fields in the class are described as private, I think that changing to public will fix this, but it's not for nothing that they are described in the manual as private data.
If there is another assumption that I am referring to the usual class, and not to the one generated by the doctrine itself, like class User extends BaseUser ...
2. I did not understand the "philosophy" of the connections. here is user.php - pastebin.com/j0nAAZrz here is goods.php - pastebin.com/4rYHRTRz and so it doesn't work like this: foreach($user->getGoods() as $good){ ...
}
Warning: Invalid argument supplied for foreach()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question