我在\vendor
文件夹中有一个实体,我无法更改/触摸,但是当我在项目中使用它时,我需要向该对象添加一个参数(description
)。
所以我有代码:
namespace SoftNation\Sylius\MyExtendBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use SoftNation\Sylius\ExtendBundle\Entity\ExtendTranslation;
/**
* @ORM\Table(name="softnation_sylius_extend_translation")
*/
class MyExtendTranslation extends ExtendTranslation
{
/**
* @ORM\Column(type="text")
*/
protected $description;
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription($description)
{
$this->description = $description;
}
}
现在当我尝试:
bin/console doctrine:migrations:diff
我收到下一个错误:
[Doctrine\DBAL\Schema\SchemaException]
The table with name
'shop_beta_dev.softnation_sylius_extend_translation' already exists.
我想要的就是我能做到:
$extend = new ExtendTranslation;
$extend->setDescription('StackOverflowRocks');
答案 0 :(得分:0)
完全像@ccKep建议 - > 在此处查看扩展模型:http://docs.sylius.org/en/latest/customization/model.html