Я столкнулся с этой ошибкой.
request.CRITICAL: Uncaught PHP Exception Doctrine\ORM\Mapping\MappingException: "Class "DefaultBundle\Entity\ArticleData" is not a valid entity or mapped super class." at /var/www/html/mamasoku/shared/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php line 346 {"exception":"[object] (Doctrine\\ORM\\Mapping\\MappingException(code: 0): Class \"DefaultBundle\\Entity\\ArticleData\" is not a valid entity or mapped super class. at /var/www/html/mamasoku/shared/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/MappingException.php:346)"} []
Мой класс ArticleData подобен этому и подтверждает, что он работает с localhost, только на сервере, он не работает.
Есть @ORM\Entity
в моем коде и doctrine настройка в порядке, я думаю.
Есть ли что-то, что мне нужно проверить ??
Таинственная ошибка отображается только на сервере.
<?php
namespace DefaultBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Eko\FeedBundle\Item\Writer\ItemInterface;
/**
*
* @ORM\Entity
* @ORM\Table(name = "articledata",indexes={
* @ORM\Index(name="rt_id",columns={"rtNum"}),
* @ORM\Index(name="publishedAt_id",columns={"publishedAt"})
* })
* @ORM\HasLifecycleCallbacks
*/
class ArticleData
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity="DefaultBundle\Entity\HeadLine", mappedBy="topArticle")
*/
private $headIds;
/**
*
* @ORM\ManyToOne(targetEntity="DefaultBundle\Entity\SiteData",inversedBy="articleIds")
* @ORM\JoinColumn(name="site_article",referencedColumnName="id")
* )
*/
private $siteId;
/**
* @ORM\Column(type="integer")
*/
private $rtNum = 0;
/**
* @ORM\Column(type="datetime",nullable=true)
*/
private $rtUpdatedAt;
/**
* @ORM\Column(type="string",nullable=false,options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"})
*/
private $title;
/**
* @ORM\Column(type="text",nullable=false,options={"collate"="utf8mb4_unicode_ci", "charset"="utf8mb4"})
*
*/
private $description;
/**
* @ORM\Column(type="string",unique=true,nullable=false)
*/
private $link;
/**
* Many Users have Many Groups.
* @ORM\ManyToMany(targetEntity="DefaultBundle\Entity\CatData", inversedBy="articleDatas")
* @ORM\JoinTable(name="articledatas_catdatas")
*/
private $catDatas;
/**
* @ORM\Column(type="string",unique=false,nullable=false)
*/
private $subject;
/**
* @ORM\Column(type="datetime")
*/
private $publishedAt;
/**
* @var \DateTime
*
* @ORM\Column(name="createdAt", type="datetime")
*/
private $createdAt;
/**
* @var \DateTime
*
* @ORM\Column(name="updatedAt", type="datetime")
*/
private $updatedAt;
/**
* @var boolean
* @ORM\Column(name="enabled",type="boolean")
*/
private $enabled = true;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set createdAt
*
* @param \DateTime $createdAt
* @return Lesson
*/
public function setCreatedAt($createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Get createdAt
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Set updatedAt
*
* @param \DateTime $updatedAt
* @return Lesson
*/
public function setUpdatedAt($updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Get updatedAt
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
/**
* Set enabled
*
* @param boolean $enabled
* @return Lesson
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
return $this;
}
/**
* Get enabled
*
* @return boolean
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* @ORM\PreUpdate
*/
public function preUpdate()
{
$this->updatedAt = new \DateTime;
}
/**
* @ORM\PrePersist
*/
public function prePersist(){
$this->createdAt = new \DateTime;
$this->updatedAt = new \DateTime;
}
public function __toString()
{
return (string) $this->getId();
}
/**
* Constructor
*/
public function __construct()
{
$this->actIds = new \Doctrine\Common\Collections\ArrayCollection();
$this->catDatas = new \Doctrine\Common\Collections\ArrayCollection();
}
public function getFeedItemTitle() {
return $this->getOriginalTitle();
}
public function getFeedItemDescription() {
$url = "http://www.erosom.info/show/" .$this->getId();
return "<a href=\"". $url . "\"><img src=\"" . $this->getXvideoThumb() . "\">" .
"</a><br />" .$this->getOriginalTitle() ;
}
public function getFeedItemPubDate() {
return $this->getUpdatedAt();
}
public function getFeedItemLink() {
#$url = $this->router->generateUrl('who', array('id' => $this->getXvideoId()));
$url = "http://www.erosom.info/show/" .$this->getId();
return $url;
}
/**
* Set rtNum
*
* @param integer $rtNum
* @return ArticleData
*/
public function setRtNum($rtNum)
{
$this->rtNum = $rtNum;
return $this;
}
/**
* Get rtNum
*
* @return integer
*/
public function getRtNum()
{
return $this->rtNum;
}
/**
* Set url
*
* @param string $url
* @return ArticleData
*/
public function setUrl($url)
{
$this->url = $url;
return $this;
}
/**
* Get url
*
* @return string
*/
public function getUrl()
{
return $this->url;
}
/**
* Set publishedAt
*
* @param \DateTime $publishedAt
* @return ArticleData
*/
public function setPublishedAt($publishedAt)
{
$this->publishedAt = $publishedAt;
return $this;
}
/**
* Get publishedAt
*
* @return \DateTime
*/
public function getPublishedAt()
{
return $this->publishedAt;
}
/**
* Add siteId
*
* @param \DefaultBundle\Entity\SiteData $siteId
* @return ArticleData
*/
public function addSiteId(\DefaultBundle\Entity\SiteData $siteId)
{
$this->siteId[] = $siteId;
return $this;
}
/**
* Remove siteId
*
* @param \DefaultBundle\Entity\SiteData $siteId
*/
public function removeSiteId(\DefaultBundle\Entity\SiteData $siteId)
{
$this->siteId->removeElement($siteId);
}
/**
* Get siteId
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSiteId()
{
return $this->siteId;
}
/**
* Set siteId
*
* @param \DefaultBundle\Entity\SiteData $siteId
* @return ArticleData
*/
public function setSiteId(\DefaultBundle\Entity\SiteData $siteId = null)
{
$this->siteId = $siteId;
return $this;
}
/**
* Set tag
*
* @param string $tag
* @return ArticleData
*/
public function setTag($tag)
{
$this->tag = $tag;
return $this;
}
/**
* Get tag
*
* @return string
*/
public function getTag()
{
return $this->tag;
}
/**
* Set title
*
* @param string $title
* @return ArticleData
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set description
*
* @param string $description
* @return ArticleData
*/
public function setDescription($description)
{
$this->description = $description;
return $this;
}
/**
* Get description
*
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* Set link
*
* @param string $link
* @return ArticleData
*/
public function setLink($link)
{
$this->link = $link;
return $this;
}
/**
* Get link
*
* @return string
*/
public function getLink()
{
return $this->link;
}
/**
* Set subject
*
* @param string $subject
* @return ArticleData
*/
public function setSubject($subject)
{
$this->subject = $subject;
return $this;
}
/**
* Get subject
*
* @return string
*/
public function getSubject()
{
return $this->subject;
}
/**
* Set rtUpdatedAt
*
* @param \DateTime $rtUpdatedAt
* @return ArticleData
*/
public function setRtUpdatedAt($rtUpdatedAt)
{
$this->rtUpdatedAt = $rtUpdatedAt;
return $this;
}
/**
* Get rtUpdatedAt
*
* @return \DateTime
*/
public function getRtUpdatedAt()
{
return $this->rtUpdatedAt;
}
/**
* Add headIds
*
* @param \DefaultBundle\Entity\HeadLine $headIds
* @return ArticleData
*/
public function addHeadId(\DefaultBundle\Entity\HeadLine $headIds)
{
$this->headIds[] = $headIds;
return $this;
}
/**
* Remove headIds
*
* @param \DefaultBundle\Entity\HeadLine $headIds
*/
public function removeHeadId(\DefaultBundle\Entity\HeadLine $headIds)
{
$this->headIds->removeElement($headIds);
}
/**
* Get headIds
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getHeadIds()
{
return $this->headIds;
}
/**
* Add catData.
*
* @param \DefaultBundle\Entity\CatData $catData
*
* @return ArticleData
*/
public function addCatData(\DefaultBundle\Entity\CatData $catData)
{
$this->catDatas[] = $catData;
return $this;
}
/**
* Remove catData.
*
* @param \DefaultBundle\Entity\CatData $catData
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeCatData(\DefaultBundle\Entity\CatData $catData)
{
return $this->catDatas->removeElement($catData);
}
/**
* Get catDatas.
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getCatDatas()
{
return $this->catDatas;
}
}
мои пакеты здесь вот так,
"require": {
"php": ">=5.3.3",
"doctrine/doctrine-bundle": "1.12.7",
"doctrine/orm": "2.7.2",
"eko/feedbundle": "1.2.9",
"friendsofsymfony/jsrouting-bundle": "~1.1",
"friendsofsymfony/rest-bundle": "@dev",
"friendsofsymfony/user-bundle": "2.1.*",
"gedmo/doctrine-extensions": "2.3.12",
"jms/serializer-bundle": "3.4.1",
"knplabs/knp-menu-bundle": "2.3.0",
"nelmio/api-doc-bundle": "@dev",
"sensio/distribution-bundle": "5.0.*",
"sensio/framework-extra-bundle": "5.4.1",
"sonata-project/admin-bundle": "3.45.0",
"sonata-project/block-bundle": "3.18.4",
"sonata-project/core-bundle": "3.17.0",
"sonata-project/doctrine-orm-admin-bundle": "3.1.0",
"stof/doctrine-extensions-bundle": "1.3.0",
"symfony/monolog-bundle": "3.1.2",
"symfony/security-bundle": "3.4.35",
"symfony/swiftmailer-bundle": "3.2.*",
"symfony/symfony": "3.4.35",
"twig/extensions": "1.5.1"
},
Моя Doctrine Конфигурация здесь ниже
# Doctrine Configuration
doctrine:
dbal:
driver: "%database_driver%"
host: "%database_host%"
port: "%database_port%"
dbname: "%database_name%"
user: "%database_user%"
password: "%database_password%"
charset: utf8mb4
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: %kernel.root_dir%/data/data.db3
# path: %database_path%
orm:
auto_generate_proxy_classes: "%kernel.debug%"
# auto_mapping: true
entity_managers:
default:
connection: default
mappings:
FOSUserBundle: ~
DefaultBundle: ~