jeff
jeff

Reputation: 1197

Symfony2 error when trying to create entity field in form

$tip->setGame($em->getRepository('XXXBundle:Game')->find($id));
        $form = $this->createFormBuilder($tip)->add('player', 'entity', array(
        'class' => 'XXXBundle::FootballPlayer',
        /*'query_builder' => function(\XXX\XXXBundle\Entity\FootballPlayerRepository $er)
        {
          $er->findByCurteam($team->getName());
        },*/
    ))->getForm();

(not really using 'XXX' in my code) error:

Warning: class_parents(): Class XXX\XXXBundle\Entity\ does not exist and could not be loaded in D:\www\xxx\xxx\vendor\doctrine\lib\Doctrine\ORM\Mapping\ClassMetadataFactory.php line 223

seems the Entity class is not found - strange

Upvotes: 0

Views: 240

Answers (1)

Snroki
Snroki

Reputation: 2444

Something is strange in your code: 'class' => 'XXXBundle::FootballPlayer', are you sure :: exist? Never seen it, seems like a mistake (maybe can provoke the error).

After testing, yes, it's because of the double :: replace by :: 'class' => 'XXXBundle:FootballPlayer',.

Upvotes: 1

Related Questions