我收到“Class PriceOrQuality\POQBundle\Entity\Tag 不是有效实体或映射的超类错误。我已经检查了类似问题的所有答案,但我似乎无法理解问题所在。
我的存储库类引发了错误
<?php
namespace PriceOrQuality\POQBundle\Entity\Repository;
use Doctrine\ORM\EntityRepository as ER;
use PriceOrQuality\POQBundle\Entity\Tag;
use Doctrine\ORM\EntityManager;
/**
* EntityTagsRepository
*
*/
class EntityTagsRepository extends ER
{
public function getTagsForTagCloud($entity_ids = null, $tag_id = null) {
$em = $this->getEntityManager();
$qb = $em->createQueryBuilder();
$qb->select(array('IDENTITY(et.tag) as id, COUNT(et.tag) as tag_id_count, LOWER(t.tag) as tag'));
$qb->from('PriceOrQuality\POQBundle\Entity\EntityTag', 'et');
$qb->leftjoin('PriceOrQuality\POQBundle\Entity\Tag','t', 'WITH', 'et.tag = t.id');
$qb->groupBy('et.tag');
$qb->addOrderBy('tag_id_count','DESC');
$qb->setMaxResults(20);
return $qb->getQuery()
->getResult();
}
}
Tag 类在此文件 (Tag.php) 中定义(仅定义):
<?php
namespace PriceOrQuality\POQBundle\Entity;
// src/PriceOrQuality/POQBundle/Entity/Tag.php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
use PriceOrQuality\POQBundle\Entity\EntityTag;
use PriceOrQuality\POQBundle\Entity\User;
use JMS\SerializerBundle\Serializer\Serializer;
/**
* @ORM\Entity(repositoryClass="PriceOrQuality\POQBundle\Entity\Repository\TagsRepository")
* @ORM\Table(name="tags")
* @ORM\HasLifecycleCallbacks
*/
你们中的任何一个聪明人都知道从哪里开始调试吗?
提前致谢,
符文