奇怪的错误:无法找到类的树类型

时间:2013-09-20 11:52:46

标签: symfony symfony-2.1 sylius

当我运行此命令php app/console doctrine:generate:form AcmeMyBundle:StudentUser时,我收到此错误:

 [Gedmo\Exception\InvalidMappingException]

 Cannot find Tree type for class: Sylius\Bundle\CoreBundle\Model\Taxon

任何想法?

编辑

好的,我不认为错误与StudentUser有关系,因为所有实体都有同样的事情:

namespace APP\Bundle\FrontBundle\Entity;


use Doctrine\ORM\Mapping as ORM;
use PUGX\MultiUserBundle\Validator\Constraints\UniqueEntity;
use Sylius\Bundle\CoreBundle\Model\User;

/**
 * @ORM\Entity(repositoryClass="App\Bundle\FrontBundle\Entity\UserRepository")
 * @ORM\Table(name="sylius_user_student")
 * @UniqueEntity(fields = "username", targetClass = "Sylius\Bundle\CoreBundle\Model\User", message="fos_user.username.already_used")
 * @UniqueEntity(fields = "email", targetClass = "Sylius\Bundle\CoreBundle\Model\User", message="fos_user.email.already_used")
 */
class StudentUser extends User
{
/**
 * @ORM\Id
 * @ORM\Column(type="integer")
 * @ORM\GeneratedValue(strategy="AUTO")
 */
protected $id;

/**
 * @var string
 *
 * @ORM\Column(name="package_name", type="string", length=100)
 */
protected $package_name;

/**
 * @var string
 *
 * @ORM\Column(name="students_available", type="string", length=100)
 */
protected $studens_available;

...

1 个答案:

答案 0 :(得分:0)

我必须是Sylius Bundle的错误, 发生此错误时,表示此实体必须具有类符号

/**
 * @Gedmo\Tree(type="nested")
 * @ORM\Entity
 */

class Service
{
}

因为某些属性使用Gedmo符号,如

 @Gedmo\TreeLevel,  @Gedmo\TreeRight

示例:

 /**
 * @Gedmo\TreeLeft
 * @ORM\Column(name="lft", type="integer", nullable=true)
 */
 private $lft;

所以你可以覆盖那个实体并纠正错误。

我希望我能提供帮助。