Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
ProjectsCrudController
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 1
 getEntityFqcn
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 configureFields
0.00% covered (danger)
0.00%
0 / 11
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace App\Controller\Admin;
4
5use App\Entity\Projects;
6use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
7use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
8use EasyCorp\Bundle\EasyAdminBundle\Field\Field;
9use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
10use EasyCorp\Bundle\EasyAdminBundle\Field\ImageField;
11use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
12
13class 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}