How to adapt modules ZfcUser/ zfcuserDoctrineORM in my project with doctrine 2 using annotations?

前端 未结 2 1213
隐瞒了意图╮
隐瞒了意图╮ 2021-02-06 12:40

I’m writing from Argentina, forgive my English little. I’m having some problems with modules ZfcUser and zfcuserDoctrineORM. I need to integrate them

2条回答
  •  我寻月下人不归
    2021-02-06 12:54

    You don't need to adapt ZfcUserDoctrineORM to use annotation mappings. DoctrineORMModule supports mixed mappings natively (it's your choice to decide which entities to map with which drivers). About ZfcUser's configuration, I personally didn't modify it at all (I only did some overrides on what ZfcUserDoctrineORM does).

    1. remove config/autoload/zfcuser.global.php (you don't need it)
    2. remove config/autoload/zfcuserdoctrineorm.global.php
    3. in the module defining your user entity, use following if you want to override the annotation driver of ZfcUserDoctrineOrm (assuming the file is in YourModule/config/module.config.php):

      // entity mappings
      'doctrine' => array(
          'driver' => array(
              'zfcuser_entity' => array(
                  // customize path
                  'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
                  'paths' => array(__DIR__ . '/../src/YourModule/Entity'),
              ),
              'orm_default' => array(
                  'drivers' => array(
                      'YourModule\Entity' => 'zfcuser_entity',
                  ),
              ),
          ),
      ),
      
      // ZfcUser specific config
      'zfcuser' => array(
          'user_entity_class'       => 'YourModule\Entity\User',
          'enable_default_entities' => false,
      ),
      

    This should work for the 0.1.x versions of ZfcUserDoctrineORM

提交回复
热议问题