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

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -