wip: integrate with easy admin bundle
This commit is contained in:
1 parent
ace251c1dd
commit
6fca40963d
15 files changed
+478
-3
No files matched your search
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace App\Controller\Admin;
|
||||
|
||||
use App\Admin\Field\JsonDataField;
|
||||
use App\Entity\BookingEditDraft;
|
||||
use App\Entity\User;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Action;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Actions;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Config\Crud;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\IntegerField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
|
||||
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
|
||||
use Symfony\Bundle\MakerBundle\Doctrine\RelationManyToOne;
|
||||
|
||||
class BookingEditDraftCrudController extends AbstractCrudController
|
||||
{
|
||||
public static function getEntityFqcn(): string
|
||||
{
|
||||
return BookingEditDraft::class;
|
||||
}
|
||||
|
||||
public function configureActions(Actions $actions): Actions
|
||||
{
|
||||
return $actions
|
||||
->add(Crud::PAGE_INDEX, Action::DETAIL)
|
||||
->remove(Crud::PAGE_INDEX, Action::NEW)
|
||||
->remove(Crud::PAGE_INDEX, Action::EDIT)
|
||||
->remove(Crud::PAGE_DETAIL, Action::EDIT)
|
||||
;
|
||||
}
|
||||
|
||||
public function configureCrud(Crud $crud): Crud
|
||||
{
|
||||
return $crud
|
||||
->setEntityLabelInSingular('Buchungsentwurf')
|
||||
->setEntityLabelInPlural('Buchungsentwürfe')
|
||||
->setDefaultSort(['createdAt' => 'DESC']);
|
||||
}
|
||||
|
||||
public function configureFields(string $pageName): iterable
|
||||
{
|
||||
return [
|
||||
IntegerField::new('bookingId', 'Buchungs ID'),
|
||||
AssociationField::new('user', 'Kundenaccount')->formatValue(fn (User $user) => $user->getEmail()),
|
||||
DateTimeField::new('createdAt', 'erstellt am'),
|
||||
DateTimeField::new('updatedAt', 'aktualisiert am'),
|
||||
JsonDataField::new('formData', 'Daten')->onlyOnDetail()
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user