30 lines
1.1 KiB
PHP
30 lines
1.1 KiB
PHP
<?php
|
|
|
|
use KupShop\AdminBundle\AdminList\BaseList;
|
|
|
|
class SlidersList extends BaseList
|
|
{
|
|
protected $showMassEdit = true;
|
|
protected $tableName = 'sliders';
|
|
|
|
protected ?string $tableAlias = 's';
|
|
|
|
protected $tableDef = [
|
|
'id' => 's.id',
|
|
'fields' => [
|
|
'name' => ['translate' => true, 'field' => 's.name', 'spec' => 's.name', 'size' => 2, 'fieldType' => BaseList::TYPE_STRING],
|
|
'images' => ['translate' => true, 'field' => 'images'],
|
|
'ID' => ['field' => 'id', 'wpjAdmin' => true],
|
|
'label' => ['translate' => true, 'field' => 's.label', 'spec' => 's.label', 'wpjAdmin' => true, 'visible' => 'N', 'fieldType' => BaseList::TYPE_STRING],
|
|
'size' => ['translate' => true, 'field' => 's.size', 'spec' => 's.size', 'wpjAdmin' => true, 'visible' => 'N', 'fieldType' => BaseList::TYPE_STRING],
|
|
],
|
|
];
|
|
|
|
public function getQuery()
|
|
{
|
|
$qb = sqlQueryBuilder()->select('s.*', 'COUNT(si.id) as images')->from('sliders', 's')->leftJoin('s', 'sliders_images', 'si', 's.id = si.id_slider')->groupBy('s.id ');
|
|
|
|
return $qb;
|
|
}
|
|
}
|