cute.S cute.S - 1 year ago 199
MySQL Question

Doctrine does not create a new table from an - already exist - entity class?

I have an entity defined as:

namespace Acme\myBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Acme\CoreBundle\Model\Message;

* Facebook Post
* @ORM\MappedSuperclass
* ORM\Table(name="acme_facebookPost")
* ORM\Entity(repositoryClass="Acme\FacebookBundle\Entity\FacebookPostRepository")
class FacebookPost extends Message
// entity properties

This entity class was created somewhere else in my project and I just moved it here.
When I run following commands to generate the entity and update my tables, it runs without error but, I can not see acme_facebookPost table in my database.

php app/console doctrine:generate:entities AcmeFacebookBundle:FacebookPost

Generating entity "Acme\FacebookBundle\Entity\FacebookPost"
> backing up FacebookPost.php to FacebookPost.php~
> generating Acme\FacebookBundle\Entity\FacebookPost

and then:

$ php app/console doctrine:schema:update --force
Nothing to update - your database is already in sync with the current entity metadata.

Can anyone tell me what I'm doing wrong here?


I need to add that I'm using annotation and there is no metadata anywhere inside my bundle.

Answer Source

It seems that you forgot to add @ before ORM\Entity(... and ORM\Table(.. hence your class is not identified as an entity

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download