Best practice to return custom JSON on API-platform
问题 I want to update my existing API (created with FOSRest). I have lots of routes that return custom JSON objects, different from my entities. For example, I have an Offer entity <?php // api/src/Entity/Offer.php namespace App\Entity; use ApiPlatform\Core\Annotation\ApiResource; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; /** * An offer from my shop - this description will be automatically extracted form the PHPDoc to document the API. * * @ApiResource