When I use findBy()
, my data is automatically serialized.
$users = $this->getDoctrine()->getRepository('AppBundle:User')->findBy($params, $orderBy, $limit, $offset);
/**
* @VirtualProperty
* @SerializedName("catagory")
* @Groups({"user"})
*/
public function getCategoryId()
{
return $this->category->getId();
}
But when I use a custom MyfindBy()
from my repository, the data is not automatically serialized. How can I automatically serialize the data?
SOLUTION :
Don't use select at the querybuilder.