Reputation: 105
I am trying to get a serialized entity response using the JmsSerializerBUndle and the FOSRestBundle. unfortunatly i'm unable to do so because i'm having problems
with the response.. i'm not sure the system recognizes the file Entity.SearchEngine.yml
Any Ideas how I could find why its not working?
#src\example\CoreBundle\Resources\config\serializer\Entity.SearchEngine.yml
Example\CoreBundle\Entity\SearchEngine:
exclusion_policy: ALL
properties:
id:
expose: true
groups: [search.list,search.details]
has_product_flight:
expose: true
groups: [search.details]
selfLink:
expose: true
groups: [self.link]
Rest action (using the FOSRestBundle):
/**
* GET /search/engines
*
* @return array
* @Rest\View(serializerGroups={"search.details", "self.link"})
*/
public function getSearchEnginesAction()
{
$searchEngineManager = $this->get('search_manager');
return $searchEngineManager->getSearchEngineList();
}
the response im getting is
{
0: { }
}
Upvotes: 2
Views: 590
Reputation: 3319
First, is SerializerBundle configured correctly? You should supply config for paths to your .yml
s and corresponding namespaces, like this:
jms_serializer:
metadata:
auto_detection: true
directories:
ExampleCoreBundle:
namespace_prefix: "Example\\CoreBundle"
path: "@ExampleCoreBundle/Resources/config/serializer/"
Be sure to check that your search.manager
service returns instances of SearchEngine
. Also, I'm not sure if dots are supported in group names.
Upvotes: 1