Spookie/src/Controller/Admin/BlogCrudController.php

40 lines
1.1 KiB
PHP
Raw Normal View History

2021-05-30 18:52:04 +02:00
<?php
namespace App\Controller\Admin;
use App\Entity\Blog;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
2021-06-14 19:20:55 +02:00
use EasyCorp\Bundle\EasyAdminBundle\Field\SlugField;
2021-05-30 18:52:04 +02:00
use EasyCorp\Bundle\EasyAdminBundle\Field\TextEditorField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
2021-06-13 13:26:41 +02:00
/**
* Class BlogCrudController
* @package App\Controller\Admin
*/
2021-05-30 18:52:04 +02:00
class BlogCrudController extends AbstractCrudController
{
public static function getEntityFqcn(): string
{
return Blog::class;
}
public function configureFields(string $pageName): iterable
{
return [
AssociationField::new('author')
->autocomplete(),
TextField::new('title'),
2021-06-14 19:20:55 +02:00
SlugField::new('slug')
->setTargetFieldName('title'),
2021-05-30 18:52:04 +02:00
TextEditorField::new('teaser'),
TextEditorField::new('content'),
DateTimeField::new('createdAt'),
AssociationField::new('editedBy')
->autocomplete()
];
}
}