与教义symfony 1.4相关的小内心问题

时间:2011-05-24 13:34:34

标签: php symfony1 doctrine doctrine-1.2 symfony-1.4

我很抱歉,但我并没有真正得到教义。我以为我有,但我想不是因为出现了以下错误:

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

1 个答案:

答案 0 :(得分:2)

因为Portfolio和Artikelkategorie之间根本没有关系。

查看投资组合中的关系。只有文章。理论建立这个的事实似乎有点奇怪。你在投资组合中定义的第二个关系是自我引用,但没有列“zustand_id”