0

我在 Zend 应用程序中升级到了 Doctrine 2。我在控制器中有以下代码:

// get instance of entity manager
$em = $this->_helper->Em();

// get instance of query builder
$qb = $em->createQueryBuilder();

$qb->select('g')
->from('Groups', 'g');

$query = $qb->getQuery();   
$aGroups = $query->getResult();

但是它会引发错误:消息:[Semantical Error] line 0, col 14 near 'Groups g': Error: Class 'Groups' is not defined。

实体位于 application/models/Entities/

感谢帮助。

4

1 回答 1

1

两个想法:

  1. Group完整的类名吗?我熟悉的 DQL 查询使用完整的类名。类上是否有一些伪命名空间,比如Application_Model_Group, Application_Entity_Group或类似的东西?

  2. 类名是单数Group而不是复数Groups吗?

于 2011-07-14T10:14:55.683 回答