Skip to content

Instantly share code, notes, and snippets.

@nclundsten
Created February 25, 2014 00:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nclundsten/9199914 to your computer and use it in GitHub Desktop.
Save nclundsten/9199914 to your computer and use it in GitHub Desktop.
<?php
namespace Authorize\Provider;
use BjyAuthorize\Provider\Role\ProviderInterface;
use BjyAuthorize\Provider\Role\Config;
class RoleProvider extends AbstractDbProvider implements ProviderInterface
{
protected $tableName = "group_roles";
public function getRoles()
{
$select = $this->getSelect();
$rows = $this->select($select);
$rolesConfig = array();
foreach ($rows as $row) {
//todo: custom hydrator for this
//todo: do something with the numeric check in config construct
$rolesConfig['role-'.$row['id']] = array(
'children' => array() //no inheritance
);
}
$config = new Config($rolesConfig);
var_dump($config);
return $config;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment