cwmiller / broadworks-connector

Simple library for connecting to BroadWorks OCI-P API
MIT License
8 stars 5 forks source link

ModifyRequest xsi:nil="true" #19

Closed TwinMist closed 5 years ago

TwinMist commented 5 years ago

Hi On a Modify Request, how do you remove a value already set on the user ie how would you remove the email address from a user. ->setextension(null) or ->setextension(false) - ->setextension() , Too few arguments to function all do not work.

thanks

cwmiller commented 5 years ago

Good find, I'm not handling nillable types properly with the library. This is a bit of a problem since all properties are set to NULL by default and the XML serializer omits any field from the XML with a NULL value.

I'm working on a fix.

TwinMist commented 5 years ago

Hi, I see from the release not there is a fix. what value do you need to use in order to remove the current value?

thanks

cwmiller commented 5 years ago

Be sure to use version 2.1.0. For any value you need to set to nil, use an instance of the Nil class.

use CWM\BroadWorksConnector\Ocip\Nil;
use CWM\BroadWorksConnector\Ocip\Models\UserModifyRequest17sp4;

...

$rq = (new UserModifyRequest17sp4())
    ->setUserId($userId)
    ->setExtension(new Nil());

This is a bit of a dirty workaround for now. The next major version will most likely do away with Nil and just treat NULL as nil.