请帮我解决下一期:
$data = $this->_jmsSerializer->deserialize('<INF_NEW OKPO="null"></INF_NEW>', 'Entity\InfNew', 'xml');
注解:
/**
* @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';
}
转储$ data的结果: -_OKPO:“null”
可是:
$data = $this->_jmsSerializer->deserialize('{"OKPO":"null"}', 'Entity\InfNew', 'json');
转储$ data的结果: -_OKPO:“测试”