学说找不到目标实体



我在尝试加载网页时在服务器上收到此错误:目标实体arcasolutions ListingBundle Entity 分类无法在'Arcasolutions ListingBundle Entity Entity Listing#分类'中找到。毫无疑问,问题是目标实体是引用列表围栏而不是分类式绑定,但是我在代码中没有任何地方都可以犯此错误。

到目前为止,我已经尝试重新启动Apache并清除学说缓存。

这是分类的代码

namespace ArcaSolutionsClassifiedBundleEntity;
use DoctrineCommonCollectionsArrayCollection;
use DoctrineORMMapping as ORM;
use DoctrineORMMappingJoinColumn;
use JMSSerializerAnnotation as Serializer;
/**
* Classified
*
* @ORMTable(name="Classified", indexes={@ORMIndex(name="country_id", columns={"location_1"}), @ORMIndex(name="state_id", columns={"location_2"}), @ORMIndex(name="region_id", columns={"location_3"}), @ORMIndex(name="latitude", columns={"latitude"}), @ORMIndex(name="longitude", columns={"longitude"}), @ORMIndex(name="level", columns={"level"}), @ORMIndex(name="status", columns={"status"}), @ORMIndex(name="account_id", columns={"account_id"}), @ORMIndex(name="city_id", columns={"location_4"}), @ORMIndex(name="area_id", columns={"location_5"}), @ORMIndex(name="title", columns={"title"}), @ORMIndex(name="friendly_url", columns={"friendly_url"}), @ORMIndex(name="cat_1_id", columns={"cat_1_id"}), @ORMIndex(name="parcat_1_level1_id", columns={"parcat_1_level1_id"}), @ORMIndex(name="fulltextsearch_keyword", columns={"fulltextsearch_keyword"}), @ORMIndex(name="fulltextsearch_where", columns={"fulltextsearch_where"})})
* @ORMEntity(repositoryClass="ArcaSolutionsClassifiedBundleRepositoryClassifiedRepository")
*/
class Classified
{
    /**
    * @var integer
    *
    * @ORMColumn(name="id", type="integer", nullable=false)
    * @ORMId
    * @ORMGeneratedValue(strategy="IDENTITY")
    * @SerializerGroups({"classifiedDetail", "Result", "listingDetail"})
    */
    private $id;
    /**
    * @ORMOneToMany(targetEntity="ArcaSolutionsListingBundleEntityListing", mappedBy="classified")
    * @ORMOrderBy({"status" = "ASC"})
    * @SerializerGroups({"classifiedDetail", "Result"})
    * @SerializerType("array")
    */
    private $listingArray;
    /**
    * Constructor
    */
    public function __construct()
    {
        $this->listingArray = new DoctrineCommonCollectionsArrayCollection();
    }
    /**
    * Add listingArray
    *
    * @param ArcaSolutionsListingBundleEntityListing $listingArray
    * @return Classified
    */
    public function addListingArray(ArcaSolutionsListingBundleEntityListing $listingArray)
    {
        $this->listingArray[] = $listingArray;
        return $this;
    }
    /**
    * Remove listingArray
    *
    * @param ArcaSolutionsListingBundleEntityListing $listingArray
    */
    public function removeListingArray(ArcaSolutionsListingBundleEntityListing $listingArray)
    {
        $this->listingArray->removeElement($listingArray);
    }
    /**
    * Get listingArray
    *
    * @return DoctrineCommonCollectionsCollection 
    */
    public function getListingArray()
    {
        return $this->listingArray;
    }
}

这是listing.php的代码(myProject src arcasolutions listingbundle entity entity listing.php)

namespace ArcaSolutionsListingBundleEntity;
use DoctrineCommonCollectionsArrayCollection;
use DoctrineORMMapping as ORM;
use DoctrineORMMappingJoinColumn;
use JMSSerializerAnnotation as Serializer;

/**
* Listing
*
* @ORMTable(name="Listing", indexes={@ORMIndex(name="title", columns={"title"}), @ORMIndex(name="country_id", columns={"location_1"}), @ORMIndex(name="state_id", columns={"location_2"}), @ORMIndex(name="region_id", columns={"location_3"}), @ORMIndex(name="account_id", columns={"account_id"}), @ORMIndex(name="renewal_date", columns={"renewal_date"}), @ORMIndex(name="status", columns={"status"}), @ORMIndex(name="latitude", columns={"latitude"}), @ORMIndex(name="longitude", columns={"longitude"}), @ORMIndex(name="level", columns={"level"}), @ORMIndex(name="city_id", columns={"location_4"}), @ORMIndex(name="area_id", columns={"location_5"}), @ORMIndex(name="zip_code", columns={"zip_code"}), @ORMIndex(name="friendly_url", columns={"friendly_url"}), @ORMIndex(name="listingtemplate_id", columns={"listingtemplate_id"}), @ORMIndex(name="image_id", columns={"image_id"}), @ORMIndex(name="thumb_id", columns={"thumb_id"}), @ORMIndex(name="idx_fulltextsearch_keyword", columns={"fulltextsearch_keyword"}), @ORMIndex(name="idx_fulltextsearch_where", columns={"fulltextsearch_where"}), @ORMIndex(name="updated_date", columns={"updated"}), @ORMIndex(name="clicktocall_number", columns={"clicktocall_number"}), @ORMIndex(name="Listing_Promotion", columns={"level", "account_id", "title", "id"})})
* @ORMEntity(repositoryClass="ArcaSolutionsListingBundleRepositoryListingRepository")
*/
class Listing
{
    /**
    * @var integer
    *
    * @ORMColumn(name="id", type="integer", nullable=false)
    * @ORMId
    * @ORMGeneratedValue(strategy="IDENTITY")
    * @SerializerGroups({"listingDetail", "Result", "classifiedDetail", "dealDetail", "reviewItem"})
    */
    private $id;
    /**
    * @var integer
    *
    * @ORMColumn(name="classified_id", type="integer", nullable=true)
    */
    private $classifiedId;
    /**
    * @ORMManyToOne(targetEntity="ArcaSolutionsClassifiedBundleEntityClassified", inversedBy="listingArray")
    * @ORMJoinColumn(name="classified_id", referencedColumnName="id")
    * @SerializerGroups({"listingDetail"})
    */
    private $classified;
    /**
    * Set classifiedId
    *
    * @param integer $classifiedId
    * @return Listing
    */
    public function setClassifiedId($classifiedId)
    {
        $this->classifiedId = $classifiedId;
        return $this;
    }
    /**
    * Get classifiedId
    *
    * @return integer 
    */
    public function getClassifiedId()
    {
        return $this->classifiedId;
    }
    /**
    * Set classified
    *
    * @param ArcaSolutionsClassifiedBundleEntityClassified $classified
    * @return Listing
    */
    public function setClassified(ArcaSolutionsClassifiedBundleEntityClassified $classified = null)
    {
        $this->classified = $classified;
        return $this;
    }
    /**
    * Get classified
    *
    * @return ArcaSolutionsClassifiedBundleEntityClassified 
    */
    public function getClassified()
    {
        return $this->classified;
    }
    /**
    * Add classifieds
    *
    * @param ArcaSolutionsClassifiedBundleEntityClassified $classifieds
    * @return Listing
    */
    public function addClassified(ArcaSolutionsClassifiedBundleEntityClassified $classifieds)
    {
        $this->classifieds[] = $classifieds;
        return $this;
    }
    /**
    * Remove classifieds
    *
    * @param ArcaSolutionsClassifiedBundleEntityClassified $classifieds
    */
    public function removeClassified(ArcaSolutionsClassifiedBundleEntityClassified $classifieds)
    {
        $this->classifieds->removeElement($classifieds);
    }
}

您的问题与这两个实体无关。看,也许您还有一个在项目中具有相同名称空间的实体?(复制纸质问题?)也许在重构后剩下的东西。

我已经创建了2个带有您的名字的捆绑包,其中2个带有您的内容的实体,并且效果很好(除了针对不存在的字段定义的索引除外)。我能够产生有效的迁移,也说" 0个无效的实体":

CREATE TABLE Classified (id INT AUTO_INCREMENT NOT NULL, PRIMARY 
KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = 
InnoDB;
CREATE TABLE Listing (id INT AUTO_INCREMENT NOT NULL, classified_id 
INT DEFAULT NULL, INDEX IDX_4BD7148A0B0417E (classified_id), PRIMARY 
KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = 
InnoDB;
ALTER TABLE Listing ADD CONSTRAINT FK_4BD7148A0B0417E FOREIGN KEY 
(classified_id) REFERENCES Classified (id);

我设法获得了错误,通过重命名为$ theclified,更改mappedby ="分类"到mappedby =" theclassified",重新生成两个捆绑包并更新DB Schema。我不确定这是如何解决错误的,因为我没有在其他任何地方引用$分类,所以这很奇怪。另外,我现在遇到一个单独的错误,我将向。

发布一个单独的问题。

相关内容

  • 没有找到相关文章

最新更新