【问题标题】:Little innerJoin problem with doctrine symfony 1.4教义symfony 1.4的小innerJoin问题
【发布时间】:2011-08-31 23:02:02
【问题描述】:

对不起,我真的不懂教义。我以为我得到了,但我猜不是因为出现以下错误:

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 查询中做错了什么?

非常感谢!!!

寻宝者

【问题讨论】:

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


    【解决方案1】:

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

    查看 Portfolio 中的关系。只有文章。此外,学说建立这一点的事实似乎有点奇怪。您在投资组合中定义的第二个关系是自引用的,但没有列“zustand_id”

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-01
      • 1970-01-01
      • 2011-01-23
      • 1970-01-01
      • 2011-04-18
      • 1970-01-01
      相关资源
      最近更新 更多