From: John P. C. <jp...@jp...> - 2001-07-16 16:28:23
|
On Mon, Jul 16, 2001 at 12:49:29PM +0200, Andreas Aderhold wrote: > > Add(&$values) does the validation, right !? Yes, the EntityManager::Add() uses information in the entity defintion to validate the input. You can, of course, override this to do any additional validation as well. > And the values I pass to EntityManager::Add($values) have the filed names + > values for my tables that are defined by this entity? > > But what if the entity spans more than one table? A common construct in my > db is for example: This is fine. The entity is a logical object (of one or more entities) that map to zero or more database tables. The relationships to other tables are defined within the entity definition, so that all the basic queries are automatically generated. > $values array( > 'newsId' => 1, > 'userId' = 22, > 'categoryId = 10, > 'text' => "Blah", > 'resourceId' = 1,4,3 > ); > > The manager then connects the resource id 1,4,3 with the news 1 updating the > tables news and newsresources!? We do things like: myobj = array ( 'FIELD1' => 'A', 'FIELD2' => 'B', 'MAILADDRESS' => array ( 'STREET' => 'Foo Ave.', 'CITY' => 'Houston', 'STATE' => 'TX', ) ); In this case there are two entities encapsulated in one. The toplevel object and the mailaddress. The joins between the two are automatically created and all the queries for selecting, inserting, deleting, etc. are created for you. > That IS really groovy!!!!! Yes it is. Gotta run to work on all this craziness. HTH. jpc |