[Components] ezcPersistentSessionInstance
Hi, first of all, my problem: Exceptioninformation: Message: The object of type Yela_Persistence_Users is not persistent. Stack trace: #0 var/www/YelaCMS/library/ezc/PersistentObject/src/persistent_session.php(127): ezcPersistentLoadHandler->refresh(Object(Yela_Persistence_Users)) How do i initialize my persistent session? (within Zend Framework bootstrapping class) (/var/www/YelaCMS/application/Bootstrap.php): /** * Initialize persistent session. * * @return ezcPersistentSession */ protected function _initEzcSession() { $this->bootstrap(array('appSession', 'database')); $db = $this->getResource('database'); $session = new ezcPersistentSession( $db, new ezcPersistentCacheManager( new ezcPersistentCodeManager( APPLICATION_PATH . DS . 'sources' . DS . 'database' . DS . 'persistence') ) ); ezcPersistentSessionInstance::set( $session ); return $session; } Current definition file looks like this (/var/www/YelaCMS/application/sources/database/persistence/yela_persistence_users.php): << this filename should be "yela_users.php" but it won't work for some reasons :) i guess this is another problem. $def = new ezcPersistentObjectDefinition(); $def->table = 'yela_users'; $def->class = 'Yela_Persistence_Users'; $def->properties['alias'] = new ezcPersistentObjectProperty(); $def->properties['alias']->columnName = 'alias'; $def->properties['alias']->propertyName = 'alias'; $def->properties['alias']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->properties['date_login_last'] = new ezcPersistentObjectProperty(); $def->properties['date_login_last']->columnName = 'date_login_last'; $def->properties['date_login_last']->propertyName = 'date_login_last'; $def->properties['date_login_last']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; $def->properties['date_register'] = new ezcPersistentObjectProperty(); $def->properties['date_register']->columnName = 'date_register'; $def->properties['date_register']->propertyName = 'date_register'; $def->properties['date_register']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; $def->idProperty = new ezcPersistentObjectIdProperty(); $def->idProperty->columnName = 'group_id'; $def->idProperty->propertyName = 'group_id'; $def->idProperty->generator= new ezcPersistentGeneratorDefinition( 'ezcPersistentManualGenerator' ); $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->properties['hash'] = new ezcPersistentObjectProperty(); $def->properties['hash']->columnName = 'hash'; $def->properties['hash']->propertyName = 'hash'; $def->properties['hash']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->idProperty = new ezcPersistentObjectIdProperty(); $def->idProperty->columnName = 'id'; $def->idProperty->propertyName = 'id'; $def->idProperty->generator= new ezcPersistentGeneratorDefinition( 'ezcPersistentSequenceGenerator' ); $def->properties['login'] = new ezcPersistentObjectProperty(); $def->properties['login']->columnName = 'login'; $def->properties['login']->propertyName = 'login'; $def->properties['login']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->properties['mail'] = new ezcPersistentObjectProperty(); $def->properties['mail']->columnName = 'mail'; $def->properties['mail']->propertyName = 'mail'; $def->properties['mail']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->properties['password'] = new ezcPersistentObjectProperty(); $def->properties['password']->columnName = 'password'; $def->properties['password']->propertyName = 'password'; $def->properties['password']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->properties['status'] = new ezcPersistentObjectProperty(); $def->properties['status']->columnName = 'status'; $def->properties['status']->propertyName = 'status'; $def->properties['status']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; return $def; The persistent object class is the following (/var/www/YelaCMS/library/Yela/Persistence/Users.php): class Yela_Persistence_Users { private $_id = null; public $group_id = null; public $alias = null; public $date_register = null; public $date_login_last = null; public $login = null; public $password = null; public $mail = null; public $hash = null; public $status = 0; public function getState() { $result = array(); $result['id'] = $this->_id; $result['group_id'] = $this->group_id; $result['alias'] = $this->alias; $res
Re: [Components] ezcPersistentSessionInstance
Hi, sorry for any inconvenience. Now i've solved my problem by setting: private $_id; to: public $id; :) > Hi, > > first of all, my problem: > > Exceptioninformation: > Message: The object of type Yela_Persistence_Users is not persistent. > Stack trace: > #0 > var/www/YelaCMS/library/ezc/PersistentObject/src/persistent_session.php(127): > ezcPersistentLoadHandler->refresh(Object(Yela_Persistence_Users)) > > > > How do i initialize my persistent session? (within Zend Framework > bootstrapping class) (/var/www/YelaCMS/application/Bootstrap.php): > > /** > * Initialize persistent session. > * > * @return ezcPersistentSession > */ > protected function _initEzcSession() > { > $this->bootstrap(array('appSession', 'database')); > $db = $this->getResource('database'); > > $session = new ezcPersistentSession( > $db, > new ezcPersistentCacheManager( > new ezcPersistentCodeManager( APPLICATION_PATH . DS . > 'sources' . DS . > 'database' . DS . > 'persistence') ) > ); > > ezcPersistentSessionInstance::set( $session ); > > return $session; > } > > > > Current definition file looks like this > (/var/www/YelaCMS/application/sources/database/persistence/yela_persistence_users.php): > << this filename should be "yela_users.php" but it won't work for some > reasons :) i guess this is another problem. > > $def = new ezcPersistentObjectDefinition(); > $def->table = 'yela_users'; > $def->class = 'Yela_Persistence_Users'; > > $def->properties['alias'] = new ezcPersistentObjectProperty(); > $def->properties['alias']->columnName = 'alias'; > $def->properties['alias']->propertyName = 'alias'; > $def->properties['alias']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_STRING; > > > $def->properties['date_login_last'] = new > ezcPersistentObjectProperty(); > $def->properties['date_login_last']->columnName = 'date_login_last'; > $def->properties['date_login_last']->propertyName = 'date_login_last'; > $def->properties['date_login_last']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_INT; > > > $def->properties['date_register'] = new > ezcPersistentObjectProperty(); > $def->properties['date_register']->columnName = 'date_register'; > $def->properties['date_register']->propertyName = 'date_register'; > $def->properties['date_register']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_INT; > > > $def->idProperty = new ezcPersistentObjectIdProperty(); > $def->idProperty->columnName = 'group_id'; > $def->idProperty->propertyName = 'group_id'; > $def->idProperty->generator= new ezcPersistentGeneratorDefinition( > 'ezcPersistentManualGenerator' ); > $def->idProperty->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_STRING; > > > $def->properties['hash'] = new ezcPersistentObjectProperty(); > $def->properties['hash']->columnName = 'hash'; > $def->properties['hash']->propertyName = 'hash'; > $def->properties['hash']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_STRING; > > > $def->idProperty = new ezcPersistentObjectIdProperty(); > $def->idProperty->columnName = 'id'; > $def->idProperty->propertyName = 'id'; > $def->idProperty->generator= new ezcPersistentGeneratorDefinition( > 'ezcPersistentSequenceGenerator' ); > > > $def->properties['login'] = new ezcPersistentObjectProperty(); > $def->properties['login']->columnName = 'login'; > $def->properties['login']->propertyName = 'login'; > $def->properties['login']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_STRING; > > > $def->properties['mail'] = new ezcPersistentObjectProperty(); > $def->properties['mail']->columnName = 'mail'; > $def->properties['mail']->propertyName = 'mail'; > $def->properties['mail']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_STRING; > > > $def->properties['password'] = new > ezcPersistentObjectProperty(); > $def->properties['password']->columnName = 'password'; > $def->properties['password']->propertyName = 'password'; > $def->properties['password']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_STRING; > > > $def->properties['status'] = new > ezcPersistentObjectProperty(); > $def->properties['status']->columnName = 'status'; > $def->properties['status']->propertyName = 'status'; > $def->properties['status']->propertyType = > ezcPersistentObjectProperty::PHP_TYPE_INT; > > return $def; > > > > The persistent object class is the following > (/var/www/YelaCMS/library/Yela/Persistence/Users.php): > > class Yela_Persistence_Users > { > private $_id = null; > public $group_id = null; > public $alias = null; > public $
[Components] ezcPersistentSessionIdentityDecorator
Hello community, i have a problem with ezcPersistentSessionIdentityDecorator. After creating definition files i tried to create a select statement to fetch all rows from all dependent tables. The createt statements works fine within MySQL-Querybrowser but not with a find() or findWithRelations method. The following code is used to create the query and fetch the results from database: // Database configuration: mysql pdo_mysql YelaCMS root test 127.0.0.1 3306 // Create database instance $dbParams = $config->get('database') ->toArray(); $db = ezcDbFactory::create( $dbParams ); $db->query('SET NAMES ' . $dbParams['charset']); ezcDbInstance::set($db, 'default'); // Create ezcSession instance $definitionManager = new ezcPersistentCacheManager( new ezcPersistentCodeManager(APP_PATH . '/database/persistence')); $identitySession = new ezcPersistentSessionIdentityDecorator( new ezcPersistentSession($db, $definitionManager), new ezcPersistentBasicIdentityMap($definitionManager)); ezcPersistentSessionInstance::set( $identitySession ); // Get Instance $ezcSession = ezcPersistentSessionInstance::get(); // Create pre relations to fetch $relations = array('yela_users_informations' => new ezcPersistentRelationFindDefinition( 'Yela_Persistence_Users_Informations'), 'yela_session' => new ezcPersistentRelationFindDefinition( 'Yela_Persistence_Session')); // Create SQL statement $query = $ezcSession->createFindQueryWithRelations( 'Yela_Persistence_Users', $relations); /** * Created SQL statement which works fine with query browser: * SELECT `yela_users`.`id` AS `id`, `yela_users`.`alias` AS `alias`, `yela_users`.`date_login_last` AS `date_login_last`, `yela_users`.`date_register` AS `date_register`, `yela_users`.`hash` AS `hash`, `yela_users`.`login` AS `login`, `yela_users`.`mail` AS `mail`, `yela_users`.`password` AS `password`, `yela_users`.`status` AS `status`, `yela_users_informations`.`user_id` AS `yela_users_informations_user_id`, `yela_users_informations`.`asterisk` AS `yela_users_informations_asterisk`, `yela_users_informations`.`birthday` AS `yela_users_informations_birthday`, `yela_users_informations`.`city` AS `yela_users_informations_city`, `yela_users_informations`.`firstname` AS `yela_users_informations_firstname`, `yela_users_informations`.`icq` AS `yela_users_informations_icq`, `yela_users_informations`.`lastname` AS `yela_users_informations_lastname`, `yela_users_informations`.`msn` AS `yela_users_informations_msn`, `yela_users_informations`.`size` AS `yela_users_informations_size`, `yela_users_informations`.`street` AS `yela_users_informations_street`, `yela_users_informations`.`zipcode` AS `yela_users_informations_zipcode`, `yela_session`.`session_id` AS `yela_session_session_id`, `yela_session`.`data` AS `yela_session_data`, `yela_session`.`datetime` AS `yela_session_datetime`, `yela_session`.`guest` AS `yela_session_guest`, `yela_session`.`user_id` AS `yela_session_user_id` FROM `yela_users` LEFT JOIN `yela_users_informations` AS `yela_users_informations` ON `yela_users`.`id` = `yela_users_informations`.`user_id` LEFT JOIN `yela_session` AS `yela_session` ON `yela_users`.`id` = `yela_session`.`user_id` */ // These two statements won't fetch all rows from ALL related tables: $result = $ezcSession->find($query); $result = $ezcSession->findWithRelations($query); /** * Zend Db Works fine with $query->getQuery() from previously created sql: * $mapper->getAdapter() *->fetchAll($query->getQuery(), * null, * Zend_Db::FETCH_ASSOC); */ I hope my english was not so bad and you can help me to fix this problem :) It should be possible to retrieve all rows from ALL related tables. greetings René as. h32Lg <> <> <> CREATE TABLE `yela_users` ( `id` int(11) unsigned NOT NULL AUTO_INCREMENT, `group_id` int(11) unsigned NOT NULL, `alias` varchar(200) NOT NULL, `date_register` datetime NOT NULL, `date_login_last` datetime NOT NULL, `login` varchar(100) NOT NULL, `password` varchar(150) NOT NULL, `mail` varchar(150) NOT NULL, `hash` varchar(32) NOT NULL, `status` tinyint(2) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`id`,`group_id`), KEY `dates` (`date_register`,`date_login_last`), KEY `user` (`login`,`mail`,`alias`), KEY `fk1` (`id`), KEY `fk2` (`group_id`) ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 PACK_KEYS=1 CREATE TABLE `yela_session` ( `session_id` varchar(255) NOT NULL, `user_id` int(11) unsigned NOT NULL, `datetime` datetime NOT NULL, `guest` tinyint(1) unsigned NOT NULL DEFAULT '1', `data` blob NOT NULL, PRIMARY KEY (`session_id`), KEY `fk1` (`user_id`), KEY `dates` (`datetime`), KEY `user` (`guest`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 CREATE TABLE `yela_users_informations` ( `user_id` int(11) unsigned NOT NULL, `firstname` varchar(4
Re: [Components] ezcPersistentSessionIdentityDecorator
Hi Tobias, no, i only use one of both methods. Both together make no sense. If i try $ezcSession->findWithRelations($query) the following exception is thrown: Fatal error: Call to private method ezcPersistentSessionIdentityDecorator::findWithRelations() from context 'Admin_Service_User' in /var/www/YelaCMS/public/YelaCMS/components/admin/services/User.php on line 111 Where $result = $ezcSession->findWithRelations($query) is on line 111. You can see in the following example, that only the columns/attributes from table one were fetched. But i need ALL attributes from ALL related tables. A foreach loop with a call to getRelatedObjects() makes no sense for me because i need all rows within one array. $result = $ezcSession->find($query); var_dump($result); array(4) { [1]=> object(Yela_Persistence_Users)#209 (28) { ["_name":protected]=> string(10) "yela_users" ["_primary":protected]=> string(2) "id" ["id"]=> string(1) "1" ["group_id"]=> NULL ["alias"]=> string(5) "admin" ["date_register"]=> string(19) "2010-02-08 23:29:24" ["date_login_last"]=> string(19) "-00-00 00:00:00" ["login"]=> string(5) "admin" ["password"]=> string(40) "askljf209jf2039jd2dclo39j0f9203hcdcwl3oi2j" ["mail"]=> string(11) "s...@ich.net" ["hash"]=> string(32) "d392d89c003c57d29e823a1064a2911a" ["status"]=> string(1) "1" ["_definition":protected]=> NULL ["_definitionConfigName":protected]=> NULL ["_db":protected]=> object(Zend_Db_Adapter_Pdo_Mysql)#54 (12) { ["_pdoType":protected]=> string(5) "mysql" ["_numericDataTypes":protected]=> array(16) { [0]=> int(0) [1]=> int(1) [2]=> int(2) ["INT"]=> int(0) ["INTEGER"]=> int(0) ["MEDIUMINT"]=> int(0) ["SMALLINT"]=> int(0) ["TINYINT"]=> int(0) ["BIGINT"]=> int(1) ["SERIAL"]=> int(1) ["DEC"]=> int(2) ["DECIMAL"]=> int(2) ["DOUBLE"]=> int(2) ["DOUBLE PRECISION"]=> int(2) ["FIXED"]=> int(2) ["FLOAT"]=> int(2) } ["_defaultStmtClass":protected]=> string(21) "Zend_Db_Statement_Pdo" ["_config":protected]=> array(11) { ["type"]=> string(5) "mysql" ["adapter"]=> string(9) "pdo_mysql" ["dbname"]=> string(7) "YelaCMS" ["username"]=> string(4) "root" ["password"]=> string(4) "test" ["host"]=> string(9) "127.0.0.1" ["port"]=> string(4) "3306" ["charset"]=> string(4) "utf8" ["persistent"]=> bool(false) ["options"]=> array(2) { ["caseFolding"]=> int(0) ["autoQuoteIdentifiers"]=> bool(true) } ["driver_options"]=> array(1) { [1002]=> string(16) "SET NAMES 'utf8'" } } ["_fetchMode":protected]=> int(2) ["_profiler":protected]=> object(Zend_Db_Profiler_Firebug)#55 (8) { ["_label":protected]=> string(24) "Zend_Db_Profiler_Firebug" ["_label_template":protected]=> string(44) "%label% (%totalCount% @ %totalDuration% sec)" ["_message":protected]=> object(Zend_Wildfire_Plugin_FirePhp_TableMessage)#56 (9) { ["_header":protected]=> array(3) { [0]=> string(4) "Time" [1]=> string(5) "Event" [2]=> string(10) "Parameters" } ["_rows":protected]=> array(3) { [0]=> array(3) { [0]=> string(7) "0.00066" [1]=> string(7) "connect" [2]=> NULL } [1]=> array(3) { [0]=> string(6) "0.0012" [1]=> string(26) "DESCRIBE `yela_admin_menu`" [2]=> NULL } [2]=> array(3) { [0]=> string(7) "0.00022" [1]=> string(117) "SELECT `yela_admin_menu`.* FROM `yela_admin_menu` WHERE (tree_left >= 0) AND (published = 1) ORDER BY `tree_left` ASC" [2]=> NULL } } ["_style":protected]=> string(5) "TABLE" ["_label":protected]=> string(42) "Zend_Db_Profiler_Firebug (3 @ 0.00208 sec)" ["_message":protected]=> NULL ["_buffered":protected]=> bool(true) ["_destroy":protected]=> bool(false) ["_ruid":protected]=> string(32) "d55f746f3e755999c66790f4e74641de" ["_options":protected]=> array(2) {
Re: [Components] ezcPersistentSessionIdentityDecorator
Hi Tobias, Ok, thats not good if this is the only way because if i have 5 related tables i need to loop through all these 5 tables and merge the results to one array. If there is no possibility with ezc to fetch all attributes at once, it should at least possible to store the manually fetched result within the persistent session?! Something like: $ezcSession->setDataManually($result); greetings René Tobias Schlitt schrieb: > Hi Christoph, > > On 04/24/2010 11:08 AM, Christoph René Pardon wrote: > >> no, i only use one of both methods. Both together make no sense. >> >> If i try $ezcSession->findWithRelations($query) the following exception >> is thrown: >> >> Fatal error: Call to private method >> ezcPersistentSessionIdentityDecorator::findWithRelations() from context >> 'Admin_Service_User' in >> /var/www/YelaCMS/public/YelaCMS/components/admin/services/User.php on >> line 111 >> >> Where $result = $ezcSession->findWithRelations($query) is on line 111. > > a, right. Didn't have the API fully in my mind anymore. Looking it up, > this is logical. > > $ezcSession->find( $query ); > > is the way to go. > >> You can see in the following example, that only the columns/attributes >> from table one were fetched. But i need ALL attributes from ALL related >> tables. > > Ah, now I get your problem. Well, this is not the way it is meant to be > used. > > The find() method only returns the root objects you intended to fetch. > To access the related objects you need to call > > $ezcSession->getRelatedObjects( $rootObject, 'ClassOfRelatedObject' ); > > This will then return the desired objects from the cache. > > In your case that would be something like: > > $users = $ezcSession->find( $query ); > > foreach ( $users as $user ) > { > $infos = $ezcSession->getRelatedObjects( > $user, > 'Yela_Persistence_Users_Informations' > ); > // ... > } > > The desired objects are fetched by the find() call, but not returned. > Calling getRelatedObjects() returns them from the internal object cache > in the session. > > HTH, cheers, > Toby -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
[Components] ezcPersistentSessionIdentityDecorator creating a sql query with createFindQuery() results in a wrong statement with missing attributes/columns
Hi lists reader :) i've a problem with creating sql statements with persistent objects of ezc. The following Code: $ezcSession = ezcPersistentSessionInstance::get(); $query = $ezcSession->createFindQuery('Yela_Persistence_Core_Acl_Rules'); var_dump($query->getQuery());die(); results in this statement: string(133) "SELECT `yela_core_acl_rules`.`assert_id`, `yela_core_acl_rules`.`privileges`, `yela_core_acl_rules`.`type` FROM `yela_core_acl_rules`" But my table looks like this: CREATE TABLE `YelaCMS`.`yela_core_acl_rules` ( `rule_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `group_id` int(10) unsigned NOT NULL, `resource_id` varchar(200) NOT NULL, `privileges` text NOT NULL, `assert_id` int(10) unsigned NOT NULL DEFAULT '0', `type` varchar(10) NOT NULL DEFAULT 'deny', PRIMARY KEY (`rule_id`) USING BTREE, KEY `fk1` (`resource_id`), KEY `fk2` (`group_id`), KEY `fk3` (`assert_id`), KEY `misc` (`type`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 There are some attributes missing in my statement. The definition file looks like this: $def = new ezcPersistentObjectDefinition(); $def->table = 'yela_core_acl_rules'; $def->class = 'Yela_Persistence_Core_Acl_Rules'; $def->idProperty = new ezcPersistentObjectIdProperty(); $def->idProperty->columnName = 'rule_id'; $def->idProperty->propertyName = 'rule_id'; $def->idProperty->generator= new ezcPersistentGeneratorDefinition( 'ezcPersistentSequenceGenerator' ); $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; $def->idProperty = new ezcPersistentObjectIdProperty(); $def->idProperty->columnName = 'group_id'; $def->idProperty->propertyName = 'group_id'; $def->idProperty->generator= new ezcPersistentGeneratorDefinition( 'ezcPersistentManualGenerator' ); $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; $def->idProperty = new ezcPersistentObjectIdProperty(); $def->idProperty->columnName = 'resource_id'; $def->idProperty->propertyName = 'resource_id'; $def->idProperty->generator= new ezcPersistentGeneratorDefinition( 'ezcPersistentManualGenerator' ); $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; $def->properties['privileges'] = new ezcPersistentObjectProperty(); $def->properties['privileges']->columnName = 'privileges'; $def->properties['privileges']->propertyName = 'privileges'; $def->properties['privileges']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->idProperty = new ezcPersistentObjectIdProperty(); $def->idProperty->columnName = 'assert_id'; $def->idProperty->propertyName = 'assert_id'; $def->idProperty->generator= new ezcPersistentGeneratorDefinition( 'ezcPersistentManualGenerator' ); $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; $def->properties['type'] = new ezcPersistentObjectProperty(); $def->properties['type']->columnName = 'type'; $def->properties['type']->propertyName = 'type'; $def->properties['type']->propertyType = ezcPersistentObjectProperty::PHP_TYPE_STRING; $def->relations['Yela_Persistence_Core_Resources'] = new ezcPersistentOneToManyRelation('yela_core_resources', 'yela_core_acl_rules'); $def->relations['Yela_Persistence_Core_Resources'] ->columnMap = array(new ezcPersistentSingleTableMap('resources_id', 'resource_id')); $def->relations['Yela_Persistence_Core_Acl_Groups'] = new ezcPersistentOneToManyRelation('yela_core_acl_groups', 'yela_core_acl_rules'); $def->relations['Yela_Persistence_Core_Acl_Groups'] ->columnMap = array(new ezcPersistentSingleTableMap('id', 'group_id')); $def->relations['Yela_Persistence_Core_Acl_Assertions'] = new ezcPersistentOneToManyRelation('yela_core_acl_assertions', 'yela_core_acl_rules'); $def->relations['Yela_Persistence_Core_Acl_Assertions'] ->columnMap = array(new ezcPersistentSingleTableMap('id', 'assert_id')); return $def; The following class represents the previous defined table: class Yela_Persistence_Core_Acl_Rules extends Yela_Db_Table { protected $_name = 'yela_core_acl_rules'; protected $_primary = 'rule_id'; public $rule_id = null; public $assert_id = null; public $group_id = null; public $privileges = '*'; public $resource_id = null; public $type = 'deny'; public function getState() { $result = array(); $result['rule_id'] = $this->rule_id; $result['group_id']= $this->group_id; $result['resource_id'] = $this->resource_id; $result['privileges'] = $this->privileges; $result['assert_id'] = $this->assert_id; $result['type']= $this->type; return $result; } } This may be a pebkac error but help will be useful :) Thank you. René -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
Re: [Components] ezcPersistentSessionIdentityDecorator ... missing attributes/columns [solved]
Hello Derick, thank you very much :) I've changed idProperty to "normal" properties. The problem was, that i've used the ezc-Tools to create the definition files. // Creates a schema.xml from current database table. // Needed for Persistent Object creation. $schema = ezcDbSchema::createFromDb( $db ); $dest = APPLICATION_PATH . DS . 'sources' . DS . 'database' . DS . 'schema.xml'; $schema->writeToFile( 'xml', $dest ); // console code to create definition files from previous created schema.xml php rungenerator.php -s ./application/sources/database/schema.xml -f xml ./application/sources/database/persistence/ (Maybe) ezcDbSchema doesn't recognize the correct types of attributes if there are multiple primary keys on a table. greetings René Derick Rethans schrieb: > On Wed, 28 Apr 2010, Christoph René Pardon wrote: > >> There are some attributes missing in my statement. >> The definition file looks like this: >> >> $def = new ezcPersistentObjectDefinition(); >> $def->table = 'yela_core_acl_rules'; >> $def->class = 'Yela_Persistence_Core_Acl_Rules'; >> >> $def->idProperty = new ezcPersistentObjectIdProperty(); >> $def->idProperty->columnName = 'rule_id'; >> $def->idProperty->propertyName = 'rule_id'; >> $def->idProperty->generator= new ezcPersistentGeneratorDefinition( >> 'ezcPersistentSequenceGenerator' ); >> $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; >> >> $def->idProperty = new ezcPersistentObjectIdProperty(); >> $def->idProperty->columnName = 'group_id'; >> $def->idProperty->propertyName = 'group_id'; >> $def->idProperty->generator= new ezcPersistentGeneratorDefinition( >> 'ezcPersistentManualGenerator' ); >> $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; >> >> $def->idProperty = new ezcPersistentObjectIdProperty(); >> $def->idProperty->columnName = 'resource_id'; >> $def->idProperty->propertyName = 'resource_id'; >> $def->idProperty->generator= new ezcPersistentGeneratorDefinition( >> 'ezcPersistentManualGenerator' ); >> $def->idProperty->propertyType = ezcPersistentObjectProperty::PHP_TYPE_INT; > > You can only have one ID property, you're overwriting rule_id and > group_id so hence they don't show up in the statement. > > Derick > > -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components
[Components] Persistent Object - relation object extractor creates wrong indexes
Hi, i'm just a little bit confused. Maybe someone can help me to solve my problem: http://gist.github.com/423926 My setup is attached. best regards René <> <> -- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components