cwmiller / broadworks-connector

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

colHeading #4

Closed TwinMist closed 6 years ago

TwinMist commented 6 years ago

Hi Is it possible to add the option to use the colHeading (element name) for the array key? echo $row->getCol()[0] . PHP_EOL; change to echo $row->getCol()['User Id'] . PHP_EOL;

will make it easyer to pull out data base on schema element name

thanks

cwmiller commented 6 years ago

Since all data objects are one-to-one representations of the BroadWork's OCI-P schema, I'd rather not modify them to include additional functionality.

If you'd like to use the column headings as an array key, then this can be achieved within your own code using array_combine:

foreach ($response->getUserTable()->getRow() as $row) {
    $row = array_combine($response->getUserTable()->getColHeading(), $row->getCol());
    echo $row['User Id'] . PHP_EOL;
}
TwinMist commented 5 years ago

hi when i try $row = array_combine($response->getserviceProviderAdminTable()->getColHeading(), $row->getCol()); getting the error PHP Fatal error: Uncaught Error: Call to undefined method CWM\BroadWorksConnector\Ocip\Models\ServiceProviderAdminGetPolicyResponse20::getserviceProviderAdminTable()

any ideas why? thanks