Skip to content
This repository has been archived by the owner on May 14, 2018. It is now read-only.

Commit

Permalink
extract table name to class member
Browse files Browse the repository at this point in the history
  • Loading branch information
bjyoungblood committed Sep 11, 2012
1 parent 2e026d8 commit 6645f82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/BjyAuthorize/Provider/Identity/ZfcUserDoctrine.php
Expand Up @@ -10,6 +10,8 @@ class ZfcUserDoctrine implements ProviderInterface
protected $userService; protected $userService;
protected $defaultRole; protected $defaultRole;


protected $tableName = 'user_role_linker';

public function __construct(EntityManager $em) public function __construct(EntityManager $em)
{ {
$this->em = $em; $this->em = $em;
Expand All @@ -26,7 +28,7 @@ public function getIdentityRoles()
// get roles associated with the logged in user // get roles associated with the logged in user
$builder = new \Doctrine\DBAL\Query\QueryBuilder($this->em->getConnection()); $builder = new \Doctrine\DBAL\Query\QueryBuilder($this->em->getConnection());
$builder->select("linker.role_id") $builder->select("linker.role_id")
->from('user_role_linker', 'linker') ->from($this->tableName, 'linker')
->where('linker.user_id = :user_id') ->where('linker.user_id = :user_id')
->setParameter('user_id', $authService->getIdentity()->getId()); ->setParameter('user_id', $authService->getIdentity()->getId());


Expand Down
4 changes: 3 additions & 1 deletion src/BjyAuthorize/Provider/Identity/ZfcUserZendDb.php
Expand Up @@ -13,6 +13,8 @@ class ZfcUserZendDb implements ProviderInterface
protected $userService; protected $userService;
protected $defaultRole; protected $defaultRole;


protected $tableName = 'user_role_linker';

public function __construct(Adapter $adapter) public function __construct(Adapter $adapter)
{ {
$this->adapter = $adapter; $this->adapter = $adapter;
Expand All @@ -29,7 +31,7 @@ public function getIdentityRoles()
// get roles associated with the logged in user // get roles associated with the logged in user
$sql = new Sql($this->adapter); $sql = new Sql($this->adapter);
$select = $sql->select() $select = $sql->select()
->from('user_role_linker'); ->from($this->tableName);


$where = new Where(); $where = new Where();
$where->equalTo('user_id', $authService->getIdentity()->getId()); $where->equalTo('user_id', $authService->getIdentity()->getId());
Expand Down

0 comments on commit 6645f82

Please sign in to comment.