Custom JSON serializers for a Symfony 3 entity
try this :
namespace AppBundle\Entity;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;use Symfony\Component\Serializer\Annotation\Groups;/** * Media * * @ORM\Table(name="medias") * @Gedmo\TranslationEntity(class="AppBundle\Entity\Translation\MediaTranslation") */class Media implements Translatable, \Serializable{ /* [...] */ /** * @var string|null * * @ORM\Column(type="text", nullable=true) * @Gedmo\Translatable * @Groups({"single_media"}) */ private $description; /* [...] */}