orm - No role detected by BjyAuthorize when login -
i working zf2, doctrine orm , bjyauthorize.
the problem when got logged in method getroles of identity returns empty.
class user implements userinterface, providerinterface{ /** * @var \doctrine\common\collections\collection * * @orm\manytomany(targetentity="application\entity\role", inversedby="user") * @orm\jointable(name="user_role_linker", * joincolumns={ * @orm\joincolumn(name="user_id", referencedcolumnname="user_id") * }, * inversejoincolumns={ * @orm\joincolumn(name="role_id", referencedcolumnname="id") * } * ) */ protected $roles; public function __construct() { $this->roles = new \doctrine\common\collections\arraycollection(); } public function addrole(\application\entity\role $role) { $this->roles[] = $role; return $this; } /** * remove role * * @param \application\entity\role $role */ public function removerole(\application\entity\role $role) { $this->roles->removeelement($role); } /** * role * * @return \doctrine\common\collections\collection */ public function getroles() { return $this->roles->getvalues(); } }
in other hand, if entity in controller , use getroles, values without problem.
could please tell me 1 problem?
this zfc-user-doctrine-orm-global:
<?php return array( 'doctrine' => array( 'driver' => array( // overriding zfc-user-doctrine-orm's config 'zfcuser_entity' => array( 'class' => 'doctrine\orm\mapping\driver\annotationdriver', 'paths' => 'module\application\src\application\entity', ), 'orm_default' => array( 'drivers' => array( 'application' => 'zfcuser_entity', ), ), ), ), 'zfcuser' => array( // telling zfcuser use our own class 'user_entity_class' => '\application\entity\user', // telling zfcuserdoctrineorm skip entities defines 'enable_default_entities' => false, ), 'bjyauthorize' => array( // using authentication identity provider, reads roles auth service's identity 'identity_provider' => 'bjyauthorize\provider\identity\authenticationidentityprovider', 'role_providers' => array( // using object repository (entity repository) load roles our acl 'bjyauthorize\provider\role\objectrepositoryprovider' => array( 'object_manager' => 'doctrine.entitymanager.orm_default', 'role_entity_class' => 'application\entity\role', ), ), ), );
do have roles defined in 'role' table, , userid <-> roleid in user_role_linker table?
Comments
Post a Comment