Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Can't Fix
-
Affects Version/s: 1.2.0-BETA1
-
Fix Version/s: None
-
Component/s: Behaviors
-
Labels:None
-
Environment:Fedora 10, php 5.2.8, nginx, symfony 1.3-beta1
Description
I know, Doctrine allows to inherit behaviors. In my schema.yml i have added Searchable behavior to an I18n behavior.
schema.yml
Screencast:
tableName: screencast
actAs:
Timestampable: ~
I18n:
fields:
- title
- is_sub_visible
actAs:
Searchable:
fields: [title]
columns:
id:
type: integer
primary: true
autoincrement: true
unsigned: true
slug: { type: string(127), notnull: true }
is_visible: boolean(false)
title: string(255)
is_sub_visible: boolean(false)
indexes:
is_visible: { fields: [is_visible] }
slug: { fields: [slug], type: unique }
By calling "Doctrine_Table::search" without defining second parameter (custom Doctrine_Query) works fine.
Then, when i pass the second paramter (by calling $q->execute() i got this exception:
Doctrine_Hydrator_Exception: Couldn't hydrate. Found non-unique key mapping named 'lang'. in /usr/lib/symfony/1.3-svn/lib/plugins/sfDoctrinePlugin/lib/vendor/doctrine/Doctrine/Hydrator/Graph.php on line 156
Hire is my test example "test.php"
test.php
<?php // initializing Screencast and ScreencastTranslation tables // in other case, will be thrown Doctrine_Exception with message "Couldn't find class ScreencastTranslation" ScreencastTable::getTable(); $i18nTable = Doctrine::getTable('ScreencastTranslation'); // create query instance and add filter by "is_sub_visible = true" column $q = $i18nTable->createQuery('st')->addWhere('st.is_sub_visible = ?', true); // run search query $q = $i18nTable->search('doctrine', $q); // prints: // FROM ScreencastTranslation st WHERE st.is_sub_visible = ? AND st.id IN (SQL:SELECT id FROM screencast_translation_index WHERE keyword = ? GROUP BY id) print $q->getDql(); $doctrineCollection = $q->execute(); // on this line throws Doctrine_Hydrator_Exception ?>
Sorry this is a known issue with the behaviors and it is a bigger problem that can't be fixed. Some behaviors just won't work together.