浏览代码

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;
}

}

正在加载...
取消
保存