From: John P. C. <jp...@jp...> - 2001-07-15 17:11:58
|
On Sun, Jul 15, 2001 at 02:55:48PM +0200, Andreas Aderhold wrote: > Hmm. Like that? Not quite, see below. > class TCategory { > var $categoryId; > var $name; > var $parentId; > > function selfCheck() { > .. > } > } > > class EtyCategory { > function Add() { > MetabaseStuff; > } > ... > } Originally, we thought of it like that, with the classes containing the state of the entity. But it quickly became apparent that the usefulness of that really didn't exist the way our system works. The managers are more "session" based. They contain no state and only handle the operations of an entity like Add, Set, Get, GetList, Delete and other BL functions a developer might add. For example: Class TCategoryManager extends EntityManager { ... function Add(&$values) { // polish up data as desired in the derived class ... your code ... return EntityManager::Add($values); // returns true/false } } // values would be past in from a client of the Manager (UI, xml request, etc). It would look like this: $values = array ( 'CATEGORYID' => 'A', 'NAME' => 'My Name', 'PARENTID' => 'B' ); $rval = $myMgr->Add($values); So, basically you are saying to the manager, "Here is some data I have. Please Add it, as only you know how." The Editor/Lister seamlessly integrate with the Managers and calls the Add/Set/Get with the appropriate values. So, in most cases you don't have to go around building these arrays. You only have to make the initial entity definition, and everything else just works. I may be oversimplifying a little, but not too much actually. HTH, jpc |