sabre-io / xml

sabre/xml is an XML library that you may not hate.
http://sabre.io/xml/
BSD 3-Clause "New" or "Revised" License
516 stars 77 forks source link

Automatically support VO properties that are specified as arrays. #77

Closed evert closed 8 years ago

evert commented 8 years ago

This is a feature for VO's such as this:

class VO {

   public $foo = [];

}

Specifying the empty array as the default will cause the parser to assume that foo may appear more than once and append elements to the array.

cc: @staabm

staabm commented 8 years ago

Nice idea!

staabm commented 8 years ago

@evert what do you think about doing the same for object type?

class VO1 {

   public $foo = new SubVo();
}

class SubVo {
  public $name;
  public $xyz;
}

in this case we would not create a new object in the deserializer but pickup the one already present in the object-property...?

evert commented 8 years ago

Well, I don't think that's valid PHP ;)

More importantly, you can actually achieve this with the mapValueObject function already.