problem about jmsserializerbundle-Collection of common programming errors
tolgap
symfony2 doctrine doctrine2 symfony-2.1 jmsserializerbundle
I’m having this issue with JMSSerializerBundle. It basically gives me an exception for something that I’ve already done. This is my entity:Edited to avoid confusion about annotation lines<?phpnamespace My\ProjectBundle\Entity; use JMS\SerializerBundle\Annotation\Type;use Doctrine\ORM\Mapping as ORM;/*** My\ProjectBundle\Entity\Music* * @ORM\Table()* @ORM\Entity(repositoryClass=”My\ProjectBundle\Entity\MusicRepository”)*/ class Music extends Post { /*** @var integer $id* * @ORM\Column(name=”id
artworkad ?
symfony2 fosuserbundle jmsserializerbundle symfony-2.3
Basically I want to deserialize json to user object. Like this$serializer = $this->get(‘jms_serializer’);$data = $serializer->deserialize($this->get(‘request’)->getContent(),’My\FooBundle\Entity\User’, ‘json’);The request data passed to deserializer:{“id”:2,”username”:”…@gmail.com”,”username_canonical”:”…@gmail.com”, … }Thrown error:request.CRITICAL: Uncaught PHP ExceptionJMS\Serializer\Exception\RuntimeException: “You must define a type forFOS\UserBundle\Model\User::$username.
Tony
symfony2 doctrine2 doctrine fosrestbundle jmsserializerbundle
I just upgraded our Symfony installation from 2.2 -> 2.3.1 (along with other dependent packages). Now it the JMS serializer no longer serializes existing doctrine objects. I outline relevant changes I’ve made below:Some of the composer.json”symfony/symfony”: “2.3.*”,”symfony/framework-bundle”: “2.3.*”,”doctrine/common”: “2.*”,”doctrine/dbal”: “2.*”,”doctrine/orm”: “2.*”,”friendsofsymfony/jsrouting-bundle”: “dev-master”,”friendsofsymfony/rest-bundle”: “0.12.*”,”friendsofsymfony/rest”: “0.*”,”jms/
Originally posted 2013-11-27 12:13:30.