DbUserGroupBackend: Adjust how to load the name of a group's parent

refs #8826
This commit is contained in:
Johannes Meyer 2015-05-29 08:57:49 +02:00
parent c94e6a3292
commit 60ce78c958
1 changed files with 16 additions and 3 deletions

View File

@ -115,10 +115,23 @@ class DbUserGroupBackend extends DbRepository implements UserGroupBackendInterfa
*/
public function getMemberships(User $user)
{
$groupQuery = $this->ds
->select()
->from(
array('g' => $this->prependTablePrefix('group')),
array(
'group_name' => 'g.name',
'parent_name' => 'gg.name'
)
)->joinLeft(
array('gg' => $this->prependTablePrefix('group')),
'g.parent = gg.id',
array()
);
$groups = array();
foreach ($this->ds->select()->from($this->prependTablePrefix('group'), array('name', 'parent')) as $group) {
// Using the raw query here due to the non-existent necessity to join, convert, or...
$groups[$group->name] = $group->parent;
foreach ($groupQuery as $group) {
$groups[$group->group_name] = $group->parent_name;
}
$membershipQuery = $this