phpsymfonyfosrestbundlesymfony2

Install JMSSerializerBundle


I installed FOSRestBundle but it needs JMSSerializerBundle.

I added in my deps the next lines:

[JMSSerializerBundle]
    git=git://github.com/schmittjoh/JMSSerializerBundle.git
    target=bundles/JMS/SerializerBundle

Here it explains how to do it: http://jmsyst.com/bundles/JMSSerializerBundle/master/installation

but when I try $php bin/vendors install it shows me an error:

[InvalidArgumentException]                                          
  The service definition "jms_serializer.serializer" does not exist.  

Solution

  • The manual says it to register the bundle with the kernel:

    new JMS\Serializer\JMSSerializerBundle($this),
    

    but the installer create the folder: vendor/bundles/JMS/SerializerBundle

    so, it must be added the next line to the AppKernel.php instead of the other:

    new JMS\SerializerBundle\JMSSerializerBundle($this),