Stof \ DoctrineExtensionsBundle: missing identifier / primary key for Doctrine2

I am trying to run Stof \ DoctrineExtensionsBundle to easily use DoctrineExtensions. However, the PHP interpreter tells me:

There is no identifier / primary key specified for Entity 'Stof \ DoctrineExtensionsBundle \ Entity \ Translation'. Each object must have an identifier / primary key.

Does anyone know how to get around this problem? I guess this is possible somewhere in the Doctrine2 annotations, but I don’t understand this, and there is already the value of “orm: index” (renaming it “orm: Id”, which seems to be the desired value, does not work).

This is the code for the translation entity class supplied with DoctrineExtensions:

/** * Stof\DoctrineExtensionsBundle\Entity\Translation * * @orm:Entity(repositoryClass="Gedmo\Translatable\Entity\Repository\TranslationRepository") * @orm:Table( * name="ext_translations", * indexes={@orm:index(name="translations_lookup_idx", columns={ * "locale", "object_class", "foreign_key" * })}, * uniqueConstraints={@orm:UniqueConstraint(name="lookup_unique_idx", columns={ * "locale", "object_class", "foreign_key", "field" * })} * ) */ class Translation extends AbstractTranslation { } 

By the way, thats a git repository if this helps something. But I could not find this point in the documentation: https://github.com/stof/DoctrineExtensionsBundle

+6
symfony doctrine2
source share
1 answer

You can try to disable stofdoctrineextensions in your /config/config.yml application before generating your getters / seters objects as follows:

 mappings: StofDoctrineExtensionsBundle: false 

It seems that the object generator does not yet support external matching.

+2
source share

All Articles