EasyAdminBundle icon indicating copy to clipboard operation
EasyAdminBundle copied to clipboard

Use PropertyTypeExtractor for field configurators

Open lukasluecke opened this issue 4 years ago • 2 comments

#3389

This already works for these specific use cases (meaning that you can actually use these fields with nested properties), but we should probably tackle this issue at a higher level as well - because there still are the metadata fields in the DTOs that don't work with nested properties.

lukasluecke avatar Jul 06 '20 12:07 lukasluecke

Not sure what's wrong with the unrelated commits, looks like something weird happened when those where merged?

lukasluecke avatar Jul 06 '20 13:07 lukasluecke

Just ran into an issue using this with an AssociationField and a ManyToMany relation, with the property typed as following:

    /**
     * @ORM\ManyToMany(targetEntity=TariffCatalog::class, inversedBy="tariffs")
     * @var Collection|TariffCatalog[]
     */
    private Collection $tariffCatalogs;

This will now extract Collection as the type, and set that as the class on the EntityType, which obviously is not correct. Not sure how common this case is, but there should probably be a catch for this at least. I'll try to add a fix or something later.

Temporary solution would be to just use ->setFormTypeOption('class', TargetEntity::class)

lukasluecke avatar Jul 23 '20 09:07 lukasluecke