correctly handle byUser

This commit is contained in:
jannisp 2021-04-26 17:05:38 +02:00
parent 857e98139c
commit 8ab7341dc6
2 changed files with 15 additions and 5 deletions

View file

@ -3,7 +3,13 @@
namespace App\Controller\Admin; namespace App\Controller\Admin;
use App\Entity\Offering; use App\Entity\Offering;
use App\Entity\User;
use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyAdminBundle\Controller\AbstractCrudController;
use EasyCorp\Bundle\EasyAdminBundle\Field\AssociationField;
use EasyCorp\Bundle\EasyAdminBundle\Field\IdField;
use EasyCorp\Bundle\EasyAdminBundle\Field\TextField;
use EasyCorp\Bundle\EasyAdminBundle\Field\DateTimeField;
class OfferingCrudController extends AbstractCrudController class OfferingCrudController extends AbstractCrudController
{ {
@ -12,14 +18,13 @@ class OfferingCrudController extends AbstractCrudController
return Offering::class; return Offering::class;
} }
/*
public function configureFields(string $pageName): iterable public function configureFields(string $pageName): iterable
{ {
return [ return [
IdField::new('id'), yield AssociationField::new('byUser'),
TextField::new('title'), yield TextField::new('title'),
TextEditorField::new('description'), yield DateTimeField::new('createdAt'),
yield TextField::new('photoFilename'),
]; ];
} }
*/
} }

View file

@ -188,4 +188,9 @@ class User implements UserInterface
return $this; return $this;
} }
public function __toString(): string
{
return (string) $this->getUsername();
}
} }