[nycphp-talk] ORM anyone?
csnyder
chsnyder at gmail.com
Tue Sep 11 16:21:30 EDT 2007
On 9/11/07, LK <lk613m at yahoo.com> wrote:
> Please help me in overcoming a mental block about this wonderful thing
> called ORM.
ORM is a concept, not a defined system. It may help to get your
questions answered if you say whether you are using an existing
framework or designing your own.
> 1. if my database contains thousands of authors and 100's of thousands of
> books, I have to 1) create each new object 2) assign each field value to it
> and 3) save it, and do this for 100's of thousands of records? Somehow that
> just does not make sense, since the records are already in the database, why
> do I have to save(..) them again?
You could think of it as exporting records from your existing database
into your new object model. It's a one-time operation across all of
your data.
> 2. If I have an existing database with 100's of thousands of rows already
> populated, how does ORM know which record corresponds to which php object?
> In other words, how do I just start using existing mysql records as php
> objects?
It doesn't. You create those relations as you build and store the new objects.
> 3. If an existing database has many relations between tables, how do I form
> complex joins between them using ORM?
Depends on the system.
If you have an existing database with complex relations, why are you
considering breaking it by migrating to something new?
--
Chris Snyder
http://chxo.com/
More information about the talk
mailing list