Questions tagged «dql»

3
Symfony2和主义-错误:无效的PathExpression。必须是StateFieldPathExpression
我有一个看起来像这样的实体: /** * @Gedmo\Tree(type="nested") * @ORM\Table(name="categories") * @ORM\Entity() */ class Category extends BaseCategory { /** * @ORM\OneToMany(targetEntity="Category", mappedBy="parent") */ protected $children; /** * @Gedmo\TreeParent * @ORM\ManyToOne(targetEntity="Category", inversedBy="children") * @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="SET NULL") */ protected $parent; } 我试图运行这样的查询: $qb = $this->em->createQueryBuilder() ->select('c.parent') ->from('Category', 'c'); $result = $qb->getQuery()->getArrayResult(); 但是,我收到以下错误: [Semantical Error] ... …

2
如何在Doctrine查询中指定空值作为过滤器?
我在Zend中使用Doctrine 1.1。我正在尝试编写一个查询,该查询将返回在特定列中具有空值的记录。 $q = Doctrine_Query::create() ->select('a.*') ->from('RuleSet a') ->where('a.vertical_id = ?', null); $ruleset_names_result = $q->execute(array(), Doctrine::HYDRATE_ARRAY); 我在规则集表中有3条记录,在vertical_id列中具有NULL值,但查询未找到这些记录。 感谢帮助。 席德
79 php  null  doctrine  dql 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.