I'm trying to use a WSDL file from a 3rd party, and they define some of their objects as inheriting from a common base class.
I can't use the real example for IP reasons, so I'll make a simple toy example:
FooUser is a class with base class "FooObject",
FooGroup is another class with base class "FooObject".
There is a method that wants an array of FooObject.
If I call it as $moo->set_Objects([$fooUserObject]);
then it complains that the method wanted a FooObject and not a FooUser.
If I call it as $moo->set_Objects($fooUserObject) then it accepts that, but outputs xml that looks like this:
<moo ...><FooObjects><userAttrib1>Field from User</userAttrib1><userAttrib2>Another field from User</userAttrib2></FooObjects></moo>
Basically, polymorphism in arrays just doesn't sit well at all.
Log in to post a comment.