Класс Doctrine \ Common \ Collections \ ArrayCollection не является допустимым сущностью или отображенным суперклассом

У меня есть три объекта:

FeatureValue.php

<?php namespace Webmuch\ProductBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * @ORM\Entity */ class FeatureValue { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length="100") */ protected $name; /** * @ORM\OneToMany(targetEntity="FeatureType", mappedBy="name") */ private $featuretype; public function __construct() { $this->featuretype = new \Doctrine\Common\Collections\ArrayCollection(); } 

FeatureType.php

 <?php namespace Webmuch\ProductBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Webmuch\ProductBundle\Entity\FeatureValue; /** * @ORM\Entity */ class FeatureType { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length=255, nullable=true) */ protected $title; /** * @ORM\ManyToOne(targetEntity="FeatureValue", inversedBy="featuretype",cascade={"persist"}) * @ORM\JoinColumn(name="feature_value_id", referencedColumnName="id") */ protected $name; public function __construct() { $this->name = new \Doctrine\Common\Collections\ArrayCollection(); } 

product.php

 <?php namespace Webmuch\ProductBundle\Entity; use Gedmo\Mapping\Annotation as Gedmo; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection as ArrayCollection; /** * @ORM\Entity * @ORM\Table() * @ORM\HasLifecycleCallbacks */ class Product { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\ManyToMany(targetEntity="Store") */ protected $store; /** * @ORM\ManyToMany(targetEntity="Webmuch\CategoryBundle\Entity\Category") */ protected $category; /** * @Gedmo\Sluggable * @ORM\Column(type="string", length=255) */ protected $title; /** * @Gedmo\Slug(updatable=false, unique=true) * @ORM\Column(type="string", length=255) */ protected $slug; /** * @ORM\Column(type="integer") */ protected $quantity; /** * @ORM\Column(type="boolean") */ protected $active; /** * @ORM\Column(type="text", length="4000", nullable="true") */ protected $preview; /** * @ORM\ManyToMany(targetEntity="FeatureType") * @ORM\JoinColumn(name="feature_type_id", referencedColumnName="id") */ protected $features; public function __toString() { return $this->getTitle(); } } 

Моя проблема в том, что когда я добавляю FeatureValue в FeatureType, тогда покажу мне ошибку. Класс «Doctrine \ Common \ Collections \ ArrayCollection» не является допустимым сущностью или отображенным суперклассом ».

В моем проекте я хочу FeatureType вместе с FeatureValue в моем объекте Product.

предположим, что в FeatureType два свойства Size и Colour.Now в FeatureType Size-Three FeatueValue Small, Medium, Large были предоставлены, а также допускаются в FeatureType Colour – Three FeatureValue Red, Green, Yello. Теперь я хочу показать и FeatureType вместе со своим FeatureValue в моем Product Entity.

Так что кто-нибудь скажет мне, как это можно сделать. Я пробовал много, но не смог.

Solutions Collecting From Web of "Класс Doctrine \ Common \ Collections \ ArrayCollection не является допустимым сущностью или отображенным суперклассом"