public function __construct($objectName = null) { parent::__construct('Group'); }
/** * Deletes the given entry from the database. * * @param Entry $domEntry The guestbook entry to delete. * * @author Christian Achatz * @version * Version 0.1, 21.05.2009<br /> */ public function deleteEntry(Entry $domEntry) { $entry = new GenericDomainObject('Entry'); $entry->setProperty('EntryID', $domEntry->getId()); // Delete the attributes of the entry, so that the object // itself can be deleted. If we don't do this, the ORM // will not be glad, because the entry still has child objects! $attributes = $this->orm->loadRelatedObjects($entry, 'Entry2LangDepValues'); foreach ($attributes as $attribute) { $this->orm->deleteObject($attribute); } // delete associated users, because we don't need them anymore. $users = $this->orm->loadRelatedObjects($entry, 'Editor2Entry'); foreach ($users as $user) { $this->orm->deleteObject($user); } // now delete entry object (associations are deleted automatically) $this->orm->deleteObject($entry); }
public function __construct($objectName = null) { parent::__construct('Application'); }
$orm->addRelationConfiguration('APF\\modules\\guestbook2009\\data', 'guestbook2009'); $orm->setConnectionName($connectionKey); $orm->setup(); // --- setup available languages ---------------------------------------------------------------- $langDe = new GenericDomainObject('Language'); $langDe->setProperty('ISOCode', 'de'); $langDe->setProperty('DisplayName', 'Deutsch'); $langDeId = $orm->saveObject($langDe); $langDe->setProperty('LanguageID', $langDeId); $langEn = new GenericDomainObject('Language'); $langEn->setProperty('ISOCode', 'en'); $langEn->setProperty('DisplayName', 'English'); $langEnId = $orm->saveObject($langEn); $langEn->setProperty('LanguageID', $langEnId); // --- create one guestbook instance ------------------------------------------------------------ $guestbook = new GenericDomainObject('Guestbook'); // --- create admin account --------------------------------------------------------------------- $user = new GenericDomainObject('User'); $user->setProperty('Username', 'admin'); $user->setProperty('Password', md5('admin')); $user->setProperty('Name', 'Admin'); $user->setProperty('Email', 'root@localhost'); $userId = $orm->saveObject($user); $user->setProperty('UserID', $userId); // --- english attributes of the guestbook ------------------------------------------------------ $titleEn = new GenericDomainObject('Attribute'); $titleEn->setProperty('Name', 'title'); $titleEn->setProperty('Value', 'My guestbook'); $titleEn->addRelatedObject('Attribute2Language', $langEn); $descriptionEn = new GenericDomainObject('Attribute'); $descriptionEn->setProperty('Name', 'description');
/** * Creates an domain object by name and properties. * * @param string $objectName Name of the object in mapping table. * @param array $properties Properties of the object. * * @return GenericORMapperDataObject The desired object or null. * * @author Christian Achatz * @version * Version 0.1, 11.05.2008<br /> * Version 0.2, 30.05.2008 (Now returns null, if no properties are available)<br /> * Version 0.3, 15.06.2008 (Now uses the constructor of GenericDomainObject to set the object name)<br /> * Version 0.4, 15.01.2011 (Added support for own domain objects and event handler)<br /> */ protected function mapResult2DomainObject($objectName, $properties) { if ($properties !== false) { // create service object if needed if (isset($this->domainObjectsTable[$objectName])) { $class = $this->domainObjectsTable[$objectName]['Class']; $object = new $class($objectName); } else { $object = new GenericDomainObject($objectName); } // set data component and object name $object->setDataComponent($this); // map properties into object foreach ($properties as $propertyName => $propertyValue) { // re-map empty values for null fields to PHP null values if (isset($this->mappingTable[$objectName][$propertyName]) && stripos($this->mappingTable[$objectName][$propertyName], self::$NULL_FIELD_IDENTIFIER) !== false && empty($propertyValue)) { $propertyValue = null; } $object->setProperty($propertyName, $propertyValue); } // call event handler $object->afterLoad(); } else { $object = null; } return $object; }
public function __construct($objectName = null) { parent::__construct('AppProxyType'); }
public function __construct($objectName = null) { parent::__construct('Permission'); }
public function __construct($objectName = null) { parent::__construct('AuthToken'); }