Re: Re: Recommended ORM for PHP

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

 



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.

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.

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.

If you are interested about more differences in the approaches, you may
check the Metastorage documentaion:

http://www.metastorage.net/

-- 

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