當我運行cmd'php bin/console doctrine:generate:entities MyBundle'生成setters時,我有以下代碼(用於2個表的廣告&城市): 並出現geters(Symfony3) 此錯誤:Symfony 3 ralation OneToMany與genarate上的關節表錯誤:enities
[語義錯誤]物業 的Ligo \ PlatformBundle \實體\廣告:: $城市註釋 「@JoinColumn」 從來沒有進口。 可能忘記爲此註釋添加「使用」語句嗎? 500 內部服務器錯誤 - AnnotationException
<?php
namespace Ligo\PlatformBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* Advert
*
* @ORM\Table(name="advert")
* @ORM\Entity(repositoryClass="Ligo\PlatformBundle\Repository\AdvertRepository")
*/
class Advert
{
/**
* @ORM\ManyToMany(targetEntity="City")
* @ORM\JoinTable(name="adverts_cities",
* joinColumns={@JoinColumn(name="advert_id", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="city_id", referencedColumnName="id", unique=true)}
* )
*/
private $cities;
哪個錯誤?你不把它放在你的帖子中... – Letsrocks
hey @Letsrocks [語義錯誤]屬性Ligo \ PlatformBundle \ Entity \ Advert :: $ cities中的註釋「@JoinColumn」從未導入。你可能忘記爲這個註釋添加一個「使用」語句嗎? 500內部服務器錯誤 - AnnotationException – emwww