I'm trying to use JMSSerializerBundle but the service isn't listed after run app/console container:debug | grep jms_serializer
$ app/console container:debug | grep jms_serializer
jms_serializer.json_deserialization_visitor container JMS\SerializerBundle\Serializer\JsonDeserializationVisit
jms_serializer.json_serialization_visitor container JMS\SerializerBundle\Serializer\JsonSerializationVisitor
jms_serializer.metadata.lazy_loading_driver container Metadata\Driver\LazyLoadingDriver
jms_serializer.metadata_driver container Metadata\Driver\DriverChain
jms_serializer.naming_strategy container JMS\SerializerBundle\Serializer\Naming\CacheNamingStrate
jms_serializer.xml_deserialization_visitor container JMS\SerializerBundle\Serializer\XmlDeserializationVisito
jms_serializer.xml_serialization_visitor container JMS\SerializerBundle\Serializer\XmlSerializationVisitor
jms_serializer.yaml_serialization_visitor container JMS\SerializerBundle\Serializer\YamlSerializationVisitor
after install
composer require jms/serializer-bundle
and configure
// in AppKernel::registerBundles()
$bundles = array(
// ...
new JMS\SerializerBundle\JMSSerializerBundle($this),
// ...
);
if thy to use in some place
$this->get('jms_serializer')
I get the error You have requested a non-existent service "jms_serializer".
How I can fix that?
The name of the service is serializer. You should just use the following.
$this->get('serializer');