Re: Re: Recommended ORM for PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2008. 02. 7, csütörtök keltezéssel 13.15-kor Manuel Lemos ezt írta:
> Hello
> 
> on 02/07/2008 07:26 AM Zoltán Németh said the following:
> >>> When creating a LAMP app, I always start by writing ORM myself.
> >>> It's fun but it usually takes a  long time.
> >>> Besides, that always results in a toy-system,
> >>> I mean, that has not so many features, not so efficient non-bug-free.
> >>>
> >>> I started to think that now is the time  to throw away my rubbish
> >>> and use more effective Open source ORM.
> >>>
> >>> So my  question is what ORM are you using?
> >>> What ORM do you recommend?
> >>> There're lots of Web app frameworks out there
> >>> but I could't find simple ORM in PHP.
> >> A similar question was asked here a couple of days ago.
> >>
> >> I will be repeating myself, but what I said was that I use Metatsorage
> >> which is an ORM class generator tool. It is a different approach than
> >> others you may find. It generates persistent object classes that are
> >> smaller and more efficient.
> > 
> > that's exactly the same method all the ORMs we mentioned earlier
> > (Doctrine, Propel, Qcodo) work. all these generate classes. ;P
> > 
> > aside from that, metastorage might be as good as any of the others of
> > course
> 
> I don't know about Doctrine and QCodo, but once I looked at Propel and
> the way it works was not exactly better than Metastorage generated
> classes from my point of view.
> 
> What happens is that Propel relies on fat base classes that the
> generated persistent object classes need to inherit to do the actual
> Object-relational mapping.
> 
> Metastorage generates self-contained code. This means the generated
> classes are root classes that do only what you need. The generated code
> does the necessary database calls directly to store and retrieve objects.
> 
> It does not call base classes like Propel generated classes that waste
> time composing SQL queries at run-time. Metastorage generated classes
> already have the necessary SQL built-in to execute the queries without
> further analysis at run-time.
> 
> Another aspect is that Metastorage features what is called report
> classes. These are classes that perform queries that you define and
> generates SQL and PHP at compile time to retrieve data from the
> persistent objects for read-only purposes.

and what if you want to switch sql server from mysql to oracle or
whatever? in propel, you change 1 line in the config, you don't have to
regenerate or rewrite anything.

the base classes are useful too because if you change your schema, you
simply regenerate them and all your extensions remain the same in the
child classes.

> 
> For instance, if you want to send a newsletter to a million subscribers
> and you just need the e-mail address and names of the subscribers, you
> can tell Metastorage to generate a report class that queries the users
> objects and retrives just the name and e-mail address. The report
> classes return arrays just like plain SELECT queries.
> 
> If you use the Propel approach you would need to retrieve 1 million
> objects of the users class just to pick the name and e-mail address,
> which is totally inefficient in terms of memory and very slow.

not at all. you can build the criteria for the select and then run a
doSelectRS method which gives you only the result set in an array, no
objects involved.

> 
> There are more differences between Metastorage and Propel (and probably
> others approach). I just wanted to make the point that the fact that
> approaches use generated code, it does not mean that all provide the
> same efficiency.

yeah, sure. however there is a payoff between efficiency and portability
and maintainability, and of course not all these orms have the same
level of these. choose the one that fits your needs best.

> 
> If you are interested about more differences in the approaches, you may
> check the Metastorage documentaion:
> 
> http://www.metastorage.net/
> 

sure, I'll check it out when I have some free time

greets
Zoltán Németh

> -- 
> 
> Regards,
> Manuel Lemos
> 
> PHP professionals looking for PHP jobs
> http://www.phpclasses.org/professionals/
> 
> PHP Classes - Free ready to use OOP components written in PHP
> http://www.phpclasses.org/
> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux