doctrine/oxm

XmlElement name attribute not working

Closed this issue · 0 comments


use Doctrine\OXM\Mapping as OXM;

/**
 * @OXM\XmlEntity
 */
class ObjectA {

/**
 * @OXM\XmlElement(type="ObjectB", name="hello")
 */
private $hello;

/**
 * @OXM\XmlElement(type="ObjectB", name="hello2")
 */
private $hello2;

.....

}

/**
 * @OXM\XmlEntity
 */
class ObjectB {

/**
 * @OXM\XmlText(type="string", name="hi1")
 */
private $hi1;

/**
 * @OXM\XmlText(type="string", name="hi2")
 */
private $hi2;

.....

}

I was expecting the following output using method marshalToString():

<object-a>
   <hello>
      <hi1>
      </hi2>
   </hello>
   <hello2>
       <hi1>
       </hi2>
   </hello2>
</object-a>

But I'm getting this:

<object-a>
   <object-b>
      <hi1>
      </hi2>
   </object-b>
   <object-b>
       <hi1>
       </hi2>
   </object-b>
</object-a>

I'm using the master branch.