开发者

Doctrine Relations Problem

开发者 https://www.devze.com 2023-02-04 09:06 出处:网络
I am trying to run this query: $record = Doctrine_Query::create() ->select(\'m.*\') ->from(\'Modification m\')

I am trying to run this query:

   $record = Doctrine_Query::create()
                        ->select('m.*')
                        ->from('Modification m')
                        ->leftJoin('m.Location l')
                        ->leftJoin('l.Site s')
                        ->where('CONCAT(s.baseUrl, s.modUrlPrefix, l.urlSuffix) = ?', (string)$url)
                        ->fetchOne();

However, it fails with the error

Doctrine_Table_Exception: Unknown relation alias Location

The relationships in the yaml file looks like this (Two one to many relationships. Both Modification and Site have many Locations):

Site:
    columns:
        id:
       开发者_如何学Python     type: integer
            primary: true
            autoincrement: true

Modification:
    columns:
        id:
            type: integer
            primary: true
            autoincrement: true

Location:
    columns:
        modification_id: integer
        site_id: integer
    relations:
        Modification:
            foreignAlias: Locations
        Site:
            foreignAlias: Locations
        Category:
            foreignAlias: Locations

What am I not putting in the yaml file that I need to? As far as I can make out, I have setup the yaml file the same as the documentation suggests.


it's m.Locations no? your yaml specifie this alias, not Location

Modification:
        foreignAlias: Locations

i never read the yaml file, so I'm not sure

0

精彩评论

暂无评论...
验证码 换一张
取 消