Symfony / Doctrine: class is not a valid entity or superclassed class

I get "Class PriceOrQuality \ POQBundle \ Entity \ Tag" is not a valid entity or a superclass matching error. I checked all the answers to similar questions, but I can not understand the problem.

The error is caused by my repository class

<?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();
    }
}

The tag class is defined in this file (Tag.php) (for definition only):

<?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 
 */

Do any of you smart guys have any ideas on where to start with debugging?

Thanks in advance,

rune

+2
source share
2 answers

Problem detected.

// @todo . -, , .

//@todo .

, , :

php app/console doctrine:mapping:info

,

, .

Cheers,

+11

. SQL-. .

( ):

$qb->leftjoin('PriceOrQuality\POQBundle\Entity\Tag','t', 'WITH', 'et.tag = t.id');

:

$qb->leftJoin('et.tag','t');

, . http://docs.doctrine-project.org/en/latest/reference/query-builder.html

0

All Articles