开发者

Little innerJoin problem with doctrine symfony 1.4

I am sorry, but I don't really get doctrine. I thought I got but I guess not because the following error is coming up:

Unknown relation alias Artikelkategorie

With the following 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

Following my action.class.php (short)

                $this->unt_cat_list = D开发者_运维技巧octrine_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();

And my php-code, but I guess it is useless:

<?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; ?>

Why ist the unkown relation coming up? What do I do wrong in the action.class.php query?

Thanks a lot!!!

Craphunter


Beacause there is simply no relation between Portfolio and Artikelkategorie.

Have a look at the relation in Portfolio. Theres only Article. Also the fact that doctrine builds this, seems a bit strange.. The second relation you have defined in portfolio is self refering, but there is no column "zustand_id"

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜