I’m working with Api Platform on a processor that enable multi entity post and I want to return an array of entity. After I generate my entities, I store them in an array like this in my process()
:
/** @var Code[] $codes*/
$codes = [];
for ($i=0; $i < $count; $i++) {
// Entity generation and flush
$codes[] = $code;
}
return $count == 1 ? $codes[0] : $codes;
And I have this error :
ApiPlatformSymfonyEventListenerWriteListener::getObjectClass():
Argument #1 ($object) must be of type object, array given, called in
/app/api/vendor/api-platform/core/src/Symfony/EventListener/WriteListener.php
on line 111
Does a solution exist to achieve this, or is this not permitted by API Platform ?