3

I want to add an item like this just to the src/Acme/AdminBundle/Entity/Artist.orm.yml:

email:
  type: string
  column: email_address
  length: 150

but I'm forced to do the same in the file Acme/AdminBundle/Entity/Artist

/**
 * @var string $email
 */
private $email;

If I don't do it, when I update the schema it shows an error:

php app/console doctrine:schema:update --force

[Doctrine\ORM\Mapping\MappingException]
An error occurred in Acme\AdminBundle\Entity\Artist

[ReflectionException]
Property email does not exist

I generated the Bundle with the yml option at the beginning.

4

2 回答 2

8

一、生成实体类文件

php app/console doctrine:generate:entities [Your]/[Bundle]/Entity/Artist --path="src/" --no-backup

如果要生成新实体,则必须给出“--path”参数。

然后,更新您的架构:

php app/console doctrine:schema:update --force
于 2013-03-27T16:54:06.357 回答
2

我有同样的问题,我设法解决了。

学说:生成:实体在“实体”处生成 .php 实体文件,但它也在“资源/配置/doctrine”处生成一个 orm 文件,如果您修改 .php 实体文件,这可能会产生冲突。

我刚刚删除了 orm 文件,它按预期工作。

于 2013-12-12T16:02:54.283 回答