2011-05-24 42 views
1

我很抱歉,但我沒有真正得到教條。我以爲我聽錯,但我想不會因爲出現以下錯誤快到了:與教條symfony 1.4的小innerJoin問題

Unknown relation alias Artikelkategorie 

用下面的schema.yml:

Artikelkategorie: 
connection: doctrine 
tableName: artikelkategorie 
columns: 
id: 
    type: integer(4) 
    fixed: false 
    unsigned: true 
    primary: true 
    autoincrement: true 
superid: 
    type: integer(4) 
    fixed: false 
    unsigned: true 
    primary: false 
    notnull: true 
    autoincrement: false 
branche_id: 
    type: integer(4) 
    fixed: false 
    unsigned: true 
    primary: false 
    notnull: true 
    autoincrement: false 
Portfolio: 
connection: doctrine 
tableName: portfolio 
columns: 
artikel_id: 
    type: integer(4) 
    fixed: false 
    unsigned: true 
    primary: true 
    autoincrement: false 
markt_id: 
    type: integer(4) 
    fixed: false 
    unsigned: true 
    primary: true 
    autoincrement: false 
relations: 
Artikel: 
    local: id 
    foreign: zustand_id 
    type: many 
Portfolio: 
    local: id 
    foreign: zustand_id 
    type: many 

繼我action.class.php(短)

   $this->unt_cat_list = Doctrine_Query::create() 
        ->select('p.*, a.*') 
        ->from('portfolio p') 
        ->innerJoin('p.Artikelkategorie a') 
        ->Where('p.markt_id = ? ', array(2)) 
        ->Where('a.superid = ?', array(1)) 
        ->Where('a.branche_id = ?', array(2)) 
        ->execute(); 

而且我的PHP代碼,但我想它是無用的:

<?php foreach ($unt_cat_list as $cat_list1): ?> 
<a href="<?php echo url_for('shop/category') . '/' . 'id/' . $cat_list1->getMarktId()?>"><?php echo $cat_list1->getMarktId() ?></a> 
<?php endforeach; ?> 

爲什麼未知的關係會出現?我在action.class.php查詢中做了什麼錯誤?

非常感謝!

Craphunter

回答

2

東陽根本就投資組合和Artikelkategorie沒有關係。

看看投資組合中的關係。只有文章。此外,教義構建這一點的事實似乎有點奇怪。您在投資組合中定義的第二個關係是自引用,但沒有列「zustand_id」