Re: New PDO-based DBAL/ORM for PEAR2

From: Date: Tue, 20 Nov 2007 20:29:43 +0000
Subject: Re: New PDO-based DBAL/ORM for PEAR2
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-48520@lists.php.net to get a copy of this message
Le 20 nov. 07 à 18:51, Michael J. I. Jackson a écrit :
On Nov 20, 2007, at 6:36 AM, Bertrand Mansion wrote:
and remove the singleton method.
Why?
Singleton what ? Doesn't mean anything for me.
The Domain layer is a good idea but is hard to implement correctly in PHP. I'd add triggers after insert/delete/update/select (didn't find them, maybe it's in already?).
There are triggers on query() and exec() already (these will be fired on every select, insert, update, delete). I'm still sorting out the details of the domain layer (as you said, it's difficult to implement correctly) so that is a definite possibility.
before/after ... update/delete/insert/select is very useful and should be trigerred at the right time.
The domain layer also has this functionality. A little bit different syntax, but the same things are possible: $a_mapper = Mapper_Author::getInstance(); $author = $a_mapper->find(3); // find author object with primary key 3 echo $author->first_name; // overload __get and __set methods provide pseudo access to fields foreach ($person->books as $book) {
    // do something with each book...
}
Here is what I do: $person->books is the same as $person->getBooks() except that the first one won't refetch from database if books are already loaded. Fields are accessed with ArrayAccess: $author['first_name']. This is more logical and PHP-like IMO. I strongly advise you to think about it :) -- Bertrand Mansion Mamasam Work : http://www.mamasam.com Blog : http://golgote.freeflux.net

« previous php.pear.dev (#48520) next »