Search code examples
doctrine-ormzend-framework2zfdoctrine

Extending the user entity of ZfcUserDoctrineORM in ZF2


I'm quite new to ZF2. I have a bunch of doctrine entities from my project in ZF1, one being a User entity.

I'm trying to extend \ZfcUserDoctrineORM\Entity\User so that I can inclue my old relationships - but with no great success.

If I try and run the schema generator ./doctrine-module orm:schema-tool:create I get an error saying the table name user already exists.

So far I've tried extending the class and setting my class as the UserEntityClass

return array(
    'zfcuser' => array(
        'UserEntityClass' => '\Application\Entity\User',
    ),
);

There doen't seem to be any documentation for the module as yet.


Solution

  • So the problem was that the default ZfcUserDoctrineORM entities were still in play. To solve this you can set EnableDefaultEntities to false like so :

    return array(
        'zfcuser' => array(
            'UserEntityClass' => '\Acme\Entity\User',
            'EnableDefaultEntities' => false
        ),
    );