Переглянути джерело

Refactoring controller

feature/ticket
Fab 3 роки тому
джерело
коміт
8a8e98a0c5
5 змінених файлів з 9 додано та 97 видалено
  1. +0
    -1
      src/Controller/Dashboard/DashboardAdminController.php
  2. +2
    -34
      src/Controller/Merchant/MerchantAdminController.php
  3. +2
    -45
      src/Controller/Section/SectionAdminController.php
  4. +5
    -2
      src/Controller/Site/PageAdminController.php
  5. +0
    -15
      src/Controller/User/UserAdminController.php

+ 0
- 1
src/Controller/Dashboard/DashboardAdminController.php Переглянути файл

@@ -22,7 +22,6 @@ class DashboardAdminController extends CaracDashboardController
yield MenuItem::linkToCrud('page', 'far fa-copy', Page::class);
yield MenuItem::subMenu('user', 'far fa-user')->setSubItems(
[
MenuItem::linkToCrud('user_index', '', User::class),
MenuItem::linkToCrud('user_merchant_index', '', UserMerchant::class),
]
);

+ 2
- 34
src/Controller/Merchant/MerchantAdminController.php Переглянути файл

@@ -3,44 +3,12 @@
namespace App\Controller\Merchant;

use App\Entity\Merchant\Merchant;
use App\Entity\Section\Section;
use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\CaracoleBundle\Controller\Merchant\MerchantAdminController as CaracMerchantAdminController;

class MerchantAdminController extends AbstractAdminController
class MerchantAdminController extends CaracMerchantAdminController
{
public static function getEntityFqcn(): string
{
return Merchant::class;
}

public function configureFields(string $pageName): iterable
{
$panel = parent::configureFields($pageName);

return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
NumberField::new('position')
->hideOnForm()
->hideOnIndex(),
CKEditorField::new('description')
->hideOnIndex(),
AssociationField::new('taxRate')
->setRequired(true)
->hideOnIndex(),
StatusField::new('status'),
],
$panel
);
}

}

+ 2
- 45
src/Controller/Section/SectionAdminController.php Переглянути файл

@@ -3,56 +3,13 @@
namespace App\Controller\Section;

use App\Entity\Section\Section;
use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\ChoiceField;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\BooleanField;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\StatusField;
use Lc\CaracoleBundle\Controller\Section\SectionAdminController as CaracSectionAdminController;

class SectionAdminController extends AbstractAdminController
class SectionAdminController extends CaracSectionAdminController
{
public static function getEntityFqcn(): string
{
return Section::class;
}

public function configureFields(string $pageName): iterable
{
$panel = parent::configureFields($pageName);

return array_merge(
[
FormField::addPanel('general'),
TextField::new('title'),
//AssociationField::new('merchant'),
ChoiceField::new('cycle')
->setRequired(true)
->setChoices(
[
'Jour' => Section::CYCLE_DAY,
'Semaine' => Section::CYCLE_WEEK,
'Mois' => Section::CYCLE_MONTH,
'Année' => Section::CYCLE_YEAR,
]
),
TextField::new('color')
->setRequired(true)
->hideOnIndex(),
NumberField::new('position')
->hideOnForm()
->hideOnIndex(),
CKEditorField::new('description')
->hideOnIndex(),
StatusField::new('status'),
BooleanField::new('isDefault', 'Section par défaut'),
],
$panel
);
}

}

+ 5
- 2
src/Controller/Site/PageAdminController.php Переглянути файл

@@ -6,14 +6,17 @@ use App\Entity\Site\Page;
use EasyCorp\Bundle\EasyAdminBundle\Field\FormField;
use EasyCorp\Bundle\EasyAdminBundle\Field\NumberField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use Lc\CaracoleBundle\Controller\AbstractAdminController;

use Lc\CaracoleBundle\Controller\AdminControllerTrait;
use Lc\SovBundle\Controller\AbstractAdminController;
use Lc\SovBundle\Field\CKEditorField;
use Lc\SovBundle\Field\ImageManagerField;
use Lc\SovBundle\Field\StatusField;
use Lc\SovBundle\Form\Common\FileManagerType;

class PageAdminController extends AbstractAdminController
{
use AdminControllerTrait;

public static function getEntityFqcn(): string
{
return Page::class;

+ 0
- 15
src/Controller/User/UserAdminController.php Переглянути файл

@@ -1,15 +0,0 @@
<?php

namespace App\Controller\User;

use App\Entity\User\User;
use Lc\CaracoleBundle\Controller\User\UserAdminController as CaracUserAdminController;

class UserAdminController extends CaracUserAdminController
{
public static function getEntityFqcn(): string
{
return User::class;
}

}

Завантаження…
Відмінити
Зберегти