简体   繁体   中英

symfony2 doctrine updating entities generates a .php file in entity directory

When I run this command:

php app/console doctrine:generate:entities MyBundleName

All the setters and getters are generated correctly, except that it generates a .php file in my Entity directory

在此处输入图片说明

with the following content

<?php

namespace Goodeed\BEBundle\Entity;

use Doctrine\ORM\EntityRepository;

/**
 * 
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class  extends EntityRepository
{
}

So if I run for example

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

I get this error:

在此处输入图片说明

I don't really care about the error because when I delete the file everything works as expected and no more errors arise. So my question is, what could cause the generation of this .php file?

My hypothesis would be that there is this kind of annotation in your Entity :

 @ORM\Entity(repositoryClass="YourBundle\Entity\ ")

With this annotation, the command you prompted has this behaviour.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM