Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added ZendDb role adapter option, Fixes #33 #45

Merged
merged 1 commit into from

3 participants

@webino

As above, but I think it will be nice to have an option to inject table object via DI also.

@bjyoungblood bjyoungblood merged commit cddd206 into bjyoungblood:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 8, 2012
  1. @bacinsky
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 1 deletion.
  1. +6 −1 src/BjyAuthorize/Provider/Role/ZendDb.php
View
7 src/BjyAuthorize/Provider/Role/ZendDb.php
@@ -12,6 +12,7 @@ class ZendDb implements ProviderInterface
{
protected $sm;
+ protected $adapterName = 'Zend\Db\Adapter\Adapter';
protected $tableName = 'user_role';
protected $roleIdFieldName = 'role_id';
protected $parentRoleFieldName = 'parent';
@@ -20,6 +21,10 @@ public function __construct($options, $serviceManager)
{
$this->sm = $serviceManager;
+ if (isset($options['adapter'])) {
+ $this->adapterName = $options['adapter'];
+ }
+
if (isset($options['table'])) {
$this->tableName = $options['table'];
}
@@ -35,7 +40,7 @@ public function __construct($options, $serviceManager)
public function getRoles()
{
- $tableGateway = new TableGateway($this->tableName, $this->sm->get('Zend\Db\Adapter\Adapter'));
+ $tableGateway = new TableGateway($this->tableName, $this->sm->get($this->adapterName));
$sql = new Select;
$sql->from($this->tableName);
Something went wrong with that request. Please try again.