Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ProjectsCrudController | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| getEntityFqcn | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| configureFields | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Controller\Admin; |
| 4 | |
| 5 | use App\Entity\Projects; |
| 6 | use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; |
| 7 | use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField; |
| 8 | use EasyCorp\Bundle\EasyAdminBundle\Field\Field; |
| 9 | use EasyCorp\Bundle\EasyAdminBundle\Field\IdField; |
| 10 | use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField; |
| 11 | use EasyCorp\Bundle\EasyAdminBundle\Field\TextField; |
| 12 | |
| 13 | class ProjectsCrudController extends AbstractCrudController |
| 14 | { |
| 15 | public static function getEntityFqcn(): string |
| 16 | { |
| 17 | return Projects::class; |
| 18 | } |
| 19 | |
| 20 | public function configureFields(string $pageName): iterable |
| 21 | { |
| 22 | yield IdField::new(propertyName: 'id') |
| 23 | ->onlyOnIndex(); |
| 24 | yield TextField::new(propertyName: 'name'); |
| 25 | yield AssociationField::new('developer'); |
| 26 | yield TextField::new(propertyName: 'description'); |
| 27 | yield ImageField::new(propertyName: 'teaserImage') |
| 28 | ->setBasePath(path: 'uploads/projects') |
| 29 | ->setUploadDir(uploadDirPath: 'public/uploads/projects') |
| 30 | ->setUploadedFileNamePattern(patternOrCallable: '[timestamp]-[slug].[extension]'); |
| 31 | yield Field::new('createdAt') |
| 32 | ->hideOnForm(); |
| 33 | } |
| 34 | } |