4

I'm having a problem with easy admin 3. I followed the instructions of the symfony doc but I end up with this error: Object of class DateTime could not be converted to string when rendering the admin.

Thank you for you help !

class ArticleCrudController extends AbstractCrudController

{

/**
 * @return string
 */
public static function getEntityFqcn(): string
{
    return Article::class;
}

/**
 * @param Crud $crud
 * @return Crud
 */
public function configureCrud(Crud $crud): Crud
{
    return $crud
        ->setDateFormat('d/m/Y')
        // ...
        ;
}

}

1 Answers1

5

In your "Article" entity you have a DateTime property. You need to implement method configureFields and return an DateTimeField. I don't know if it's the good way but it will fix your error.

br-dev
  • 232
  • 3
  • 10
  • It took me ages to figure it out. I had no problem on php 7.4.0 though in production 7.4.8 things were different. Link on how to implement configureFields https://symfony.com/doc/current/bundles/EasyAdminBundle/fields.html#configuring-the-fields-to-display – M at Sep 10 '20 at 16:52