We have several Doctrine entities linked like this: Order contains N boxes, each box contains several tracking numbers. I want to add a getTrackingNumbers method to Order Entity:
/**
* @ApiResource
*
* @ORM\Entity
*/
class Order {
...
/**
* @return TrackingNumber[]
*/
public function getTrackingNumbers()
{
$numbers = [];
// some logic here
return $numbers;
}
Generated schema contains trackingNumbers: Iterable! instead of specific type. How can I fix annotation? It is working fine if I query boxes collection and then trackingNumbers collection, but I do not want to expose my DB schema and force the client to loop through properties he do not need. I tried to use Subresource annotation, but it did not helped.
We have several Doctrine entities linked like this: Order contains N boxes, each box contains several tracking numbers. I want to add a
getTrackingNumbersmethod to Order Entity:Generated schema contains
trackingNumbers: Iterable!instead of specific type. How can I fix annotation? It is working fine if I query boxes collection and then trackingNumbers collection, but I do not want to expose my DB schema and force the client to loop through properties he do not need. I tried to useSubresourceannotation, but it did not helped.