admin
admin copied to clipboard
Subobjects not shown or crash Admin
API Platform version(s) affected: 3.2.16
Description
With readableLink false Collection displayed as links, single is empty:
#[Groups(groups: ['Main:write'])]
#[ORM\OneToMany(mappedBy: 'main', targetEntity: Sub::class, orphanRemoval: true, cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
#[ApiProperty(readableLink: false, writableLink: false)]
private Collection $subs;
#[Groups(groups: ['Main:write'])]
#[ApiProperty(readableLink: false, writableLink: false)]
#[ORM\ManyToOne(inversedBy: 'mains', cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
private ?One $one = null;
With readableLink true Collection displayed as json:
#[Groups(groups: ['Main:write'])]
#[ORM\OneToMany(mappedBy: 'main', targetEntity: Sub::class, orphanRemoval: true, cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
#[ApiProperty(readableLink: true, writableLink: true)]
private Collection $subs;
With readableLink true Object, Admin crashes:
#[Groups(groups: ['Main:write'])]
#[ApiProperty(readableLink: true, writableLink: true)]
#[ORM\ManyToOne(inversedBy: 'mains', cascade: ['remove', 'persist', 'refresh', 'merge', 'detach'])]
private ?One $one = null;
Unhandled Runtime Error
TypeError: data.map is not a function
Unhandled Runtime Error
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `CustomError`.
How to reproduce Full example: https://github.com/ili101/api-platform/tree/adminTest