symfony2在';中找不到目标实体OC\PlatformBundle\entity\Image;OC\PlatformBundle\Entity\Advert#image
我在更新时找不到问题的解决方案:在“OC\PlatformBundle\entity\Advert#Image”中找不到目标实体OC\PlatformBundle\entity\Image www.Advert.php:symfony2在';中找不到目标实体OC\PlatformBundle\entity\Image;OC\PlatformBundle\Entity\Advert#image,symfony,Symfony,我在更新时找不到问题的解决方案:在“OC\PlatformBundle\entity\Advert#Image”中找不到目标实体OC\PlatformBundle\entity\Image www.Advert.php: <?php namespace OC\PlatformBundle\Entity; use Doctrine\ORM\Mapping as ORM; /** * Advert * * @ORM\Table(name="oc_advert") * @ORM\Entit
<?php
namespace OC\PlatformBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Advert
*
* @ORM\Table(name="oc_advert")
* @ORM\Entity(repositoryClass="OC\PlatformBundle\Entity\AdvertRepository")
*/
class Advert
{
public function __construct()
{
// Par défaut, la date de l'annonce est la date d'aujourd'hui
$this->date = new \Datetime();
}
/**
* @ORM\OneToOne(targetEntity="OC\PlatformBundle\Entity\Image", cascade={"persist"})
*/
private $image;
public function getImage()
{
return $this->image;
}
public function setImage(Image $image = null)
{
$this->image = $image;
}
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var \DateTime
*
* @ORM\Column(name="date", type="datetime")
*/
private $date;
/**
* @var string
*
* @ORM\Column(name="title", type="string", length=255)
*/
private $title;
/**
* @var string
*
* @ORM\Column(name="author", type="string", length=255)
*/
private $author;
/**
* @var string
*
* @ORM\Column(name="content", type="text")
*/
private $content;
/**
* Get id
*
* @return integer
*/
public function getId()
{
return $this->id;
}
/**
* Set date
*
* @param \DateTime $date
*
* @return Advert
*/
public function setDate($date)
{
$this->date = $date;
return $this;
}
/**
* Get date
*
* @return \DateTime
*/
public function getDate()
{
return $this->date;
}
/**
* Set title
*
* @param string $title
*
* @return Advert
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Set author
*
* @param string $author
*
* @return Advert
*/
public function setAuthor($author)
{
$this->author = $author;
return $this;
}
/**
* Get author
*
* @return string
*/
public function getAuthor()
{
return $this->author;
}
/**
* Set content
*
* @param string $content
*
* @return Advert
*/
public function setContent($content)
{
$this->content = $content;
return $this;
}
/**
* Get content
*
* @return string
*/
public function getContent()
{
return $this->content;
}
/**
* @ORM\Column(name="published", type="boolean")
*/
private $published = true;
/**
* Set published
*
* @param boolean $published
*
* @return Advert
*/
public function setPublished($published)
{
$this->published = $published;
return $this;
}
/**
* Get published
*
* @return boolean
*/
public function getPublished()
{
return $this->published;
}
}
你把平台
拼错了OC\Plat-->eNo,包总是这样写,没有e,只是在我的消息中键入了错误。正确的错误消息是:在“OC\PlatformBundle\entity\Advert\Image”中找不到目标实体OC\PlatformBundle\entity\Image。问题出在实体文件的扩展名上