Jms deserialize xml setter not working but it works fine with json -


please me next issue:

$data = $this->_jmsserializer->deserialize('<inf_new okpo="null"></inf_new>', 'entity\infnew', 'xml'); 

annotations:

/**      * @jms\accessor(getter="getokpo",setter="setokpo")      * @jms\type("string")      * @jms\groups({"inf_new"})      * @jms\serializedname("okpo")      * @jms\xmlattribute      */     private $_okpo; 

getter , setter:

public function setokpo($okpo)     {         $this->_okpo = 'test';     }      /**      * @return mixed      */     public function getokpo()     {         return 'test';     } 

result of dumping $data: -_okpo: "null"

but:

$data = $this->_jmsserializer->deserialize('{"okpo":"null"}', 'entity\infnew', 'json'); 

result of dumping $data: -_okpo: "test"


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

r - Update two sets of radiobuttons reactively - shiny -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -