34 lines
1016 B
PHP
34 lines
1016 B
PHP
<?php
|
|
|
|
use KupShop\AdminBundle\AdminList\BaseList;
|
|
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: hanz
|
|
* Date: 3.6.14
|
|
* Time: 12:30.
|
|
*/
|
|
class UsersGroupsList extends BaseList
|
|
{
|
|
use AdminListSortable;
|
|
protected $showMassEdit = true;
|
|
protected $tableName = 'users_groups';
|
|
protected ?string $tableAlias = 'ug';
|
|
|
|
protected $tableDef = [
|
|
'id' => 'id',
|
|
'fields' => [
|
|
'name' => ['translate' => true, 'field' => 'ug.name', 'spec' => 'ug.name', 'fieldType' => BaseList::TYPE_STRING],
|
|
'description' => ['translate' => true, 'field' => 'ug.descr', 'spec' => 'ug.descr', 'render' => 'renderHTML', 'fieldType' => BaseList::TYPE_STRING],
|
|
'users_in_group' => ['translate' => true, 'field' => 'count'],
|
|
],
|
|
];
|
|
|
|
public function getQuery()
|
|
{
|
|
$qb = sqlQueryBuilder()->select('id', '(SELECT COUNT(ugr.id_user) FROM `users_groups_relations` as ugr WHERE ugr.id_group=ug.id) as count')->from('users_groups', 'ug');
|
|
|
|
return $qb;
|
|
}
|
|
}
|