mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 10:33:49 +00:00
Initialize a CRUD for entities
This commit is contained in:
43
Controller/AdminCountryCRUDController.php
Normal file
43
Controller/AdminCountryCRUDController.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace Chill\MainBundle\Controller;
|
||||
|
||||
use Chill\MainBundle\CRUD\Controller\CRUDController;
|
||||
use Chill\MainBundle\Entity\Country;
|
||||
use Chill\MainBundle\Pagination\PaginatorFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
class AdminCountryCRUDController extends CRUDController
|
||||
{
|
||||
|
||||
function __construct(PaginatorFactory $paginator)
|
||||
{
|
||||
$this->paginatorFactory = $paginator;
|
||||
}
|
||||
|
||||
protected function getEntity(): string
|
||||
{
|
||||
return Country::class;
|
||||
}
|
||||
|
||||
protected function orderingOptions(): array
|
||||
{
|
||||
return [
|
||||
'countryCode' => 'ASC'
|
||||
];
|
||||
}
|
||||
|
||||
protected function getTemplateParameters($action): array
|
||||
{
|
||||
switch ($action) {
|
||||
case 'index':
|
||||
return [
|
||||
'columns' => [ 'countryCode', 'name' ],
|
||||
'title' => 'Liste des pays'
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user