Permalink
Browse files

extract table name to class member

  • Loading branch information...
1 parent 2e026d8 commit 6645f826cd24dd8d7f2bf403a0be0d791c2ca773 @bjyoungblood committed Sep 11, 2012
@@ -10,6 +10,8 @@ class ZfcUserDoctrine implements ProviderInterface
protected $userService;
protected $defaultRole;
+ protected $tableName = 'user_role_linker';
+
public function __construct(EntityManager $em)
{
$this->em = $em;
@@ -26,7 +28,7 @@ public function getIdentityRoles()
// get roles associated with the logged in user
$builder = new \Doctrine\DBAL\Query\QueryBuilder($this->em->getConnection());
$builder->select("linker.role_id")
- ->from('user_role_linker', 'linker')
+ ->from($this->tableName, 'linker')
->where('linker.user_id = :user_id')
->setParameter('user_id', $authService->getIdentity()->getId());
@@ -13,6 +13,8 @@ class ZfcUserZendDb implements ProviderInterface
protected $userService;
protected $defaultRole;
+ protected $tableName = 'user_role_linker';
+
public function __construct(Adapter $adapter)
{
$this->adapter = $adapter;
@@ -29,7 +31,7 @@ public function getIdentityRoles()
// get roles associated with the logged in user
$sql = new Sql($this->adapter);
$select = $sql->select()
- ->from('user_role_linker');
+ ->from($this->tableName);
$where = new Where();
$where->equalTo('user_id', $authService->getIdentity()->getId());

0 comments on commit 6645f82

Please sign in to comment.