Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Stof\DoctrineExtensionsBundle: missing identifier/primary key for Doctrine2

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

No identifier/primary key specified for Entity 'Stof\DoctrineExtensionsBundle\Entity\Translation'. Every Entity must have an identifier/primary key.

Does anyone know how to circumvent this problem? I guess it is possible somewhere in the annotations of Doctrine2, but I do not understand it that much and there already is an "orm:index" value (renaming it by "orm:Id", which seems to be the required value, does not work).

That’s the code of Translation entity class shipped 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, that’s the git repository if this helps anything. But I was not able to find this point within the documentation: https://github.com/stof/DoctrineExtensionsBundle

like image 553
aufziehvogel Avatar asked Apr 01 '11 19:04

aufziehvogel


1 Answers

You can try to disable the stofdoctrineextensions in your app/config/config.yml before generate your entities getters/setters like this:

mappings:
        StofDoctrineExtensionsBundle: false

Looks like the entities generator doesn't support external mapping yet.

like image 131
oxidec Avatar answered Nov 17 '22 03:11

oxidec