#1500: Alias and left join
-----------------------------------+----------------------------------------
 Reporter:  griotteau              |       Owner:  romanb
     Type:  defect                 |      Status:  new   
 Priority:  major                  |   Milestone:        
Component:  Relations              |     Version:  0.11  
 Keywords:  alias relation         |    Has_test:  0     
 Mystatus:  Pending Core Response  |   Has_patch:  0     
-----------------------------------+----------------------------------------
 I have an issue with a relation on a column which have an alias

 My class :
 {{{
 class ctkUser extends Doctrine_record {
    public function setTableDefinition() {
      $this->hasColumn('USER_ID as id', 'integer', 5, array('type' =>
 'integer', 'length' => '5','autoincrement'=>true, 'primary'=>true));
      ....
    }

   public function setUp() {
      $this->hasMany('AnnuaireContactAccessUser', array('local' =>
 'id','foreign' => 'user_id'));
   }

 }
 }}}


 The query :

 {{{
   $users = Doctrine_query::create()->
       from('ctkUser U')->
       leftJoin("U.AnnuaireContactAccessUser ta")->
       where("ta.contact_id=?",array(219))->
       execute();
 }}}

 and the error :
   Column not found: 1054 Unknown column 'f.id' in 'on clause'

 at Doctrine_Connection->execute('SELECT f.user_id AS f__user_id,  ...,
 a.contact_id AS a__contact_id, a.user_id AS a__user_id FROM FED_USER f
 LEFT JOIN annuaire_contact_access_user a ON f.id = a.user_id WHERE
 a.contact_id = ?', array('219'))


 there is no error if i use the column name, not the alias
 ($this->hasMany('AnnuaireContactAccessUser', array('local' =>'user_id',
 'foreign' => 'user_id'))

-- 
Ticket URL: <http://trac.doctrine-project.org/ticket/1500>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"doctrine-svn" group.
 To post to this group, send email to [email protected]
 To unsubscribe from this group, send email to [EMAIL PROTECTED]
 For more options, visit this group at 
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---

Reply via email to