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: <database> <type>mysql</type> <adapter>pdo_mysql</adapter> <dbname>YelaCMS</dbname> <username>root</username> <password>test</password> <host>127.0.0.1</host> <port>3306</port> <!--<socket>/var/run/mysqld/mysqld.sock</socket> <charset>utf8</charset> <profiler> <enabled><zf:const zf:name="TRUE"/></enabled> <class>Zend_Db_Profiler_Firebug</class> </profiler>--> </database> // 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
<<attachment: definition_session.php>>
<<attachment: definition_users.php>>
<<attachment: definition_users_informations.php>>
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(45) NOT NULL, `lastname` varchar(45) NOT NULL, `zipcode` varchar(10) DEFAULT NULL, `street` varchar(60) DEFAULT NULL, `city` varchar(60) DEFAULT NULL, `icq` int(9) unsigned DEFAULT NULL, `msn` varchar(110) DEFAULT NULL, `birthday` datetime DEFAULT NULL, `asterisk` varchar(45) DEFAULT NULL, `size` int(3) unsigned DEFAULT NULL, PRIMARY KEY (`user_id`), KEY `user` (`firstname`,`lastname`,`zipcode`,`city`,`birthday`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 PACK_KEYS=1
-- Components mailing list Components@lists.ez.no http://lists.ez.no/mailman/listinfo/components