More information about the Underscore mailing list

[_] Calling PHP Heads...

Adam Nicholls inkysplat at
Fri Jul 12 10:17:35 BST 2013

Hi Guys/Gals,

I'm doing some integration work with a COM API and according to their
documentation to save data in the API, you have to assign to the

This is their example in Visual Basic (VBA?)

    Set oBank = New Bank
    oBank.Init Application.SessionContext
    With oBank
        .Fields(BANK_fld_ACCOUNT_NAME) = "Test account"
        .Fields(BANK_fld_ACCOUNT_NO) = "12345"
        .Fields(BANK_fld_BANK) = "Bank of the Nation"
        .Fields(BANK_fld_BRANCH_NAME) = "State Street Branch"
    End With

Obviously in PHP is isn't possible to assign to a method in this way
(thats what parameters are for!) So I'm at a bit of a loose end. I'm
wondering if anyone else has come across this? Or am I missing
something obvious in PHP's implementation of the COM that allows me to
work around this?

My PHP Code is looks like this:
$API = new COM('API');
$API->Init($SerialNo, $Login, '', 1, '', 1);
$API->SignOutOnTerminate = True;

$Record = new COM("Data.Bank");

$Record->Fields('ACCOUNT_NAME') = 'Test Account';//doesn't work

I've also tried (below) but the API says wrong number of parameters

$Record->Fields('ACCOUNT_NAME', 'Test Account');

I've also tried something crazy like this (below) but that overwrites
the $Record object and means I can't call the Save() method.

$_R = &$Record->Fields('ACCOUNT_NAME');
$_R = 'Test Account';

Any ideas? Is it possible? I'm able to read data through the API so I
know it's working I just can figure out how to do the assignment.

Many Thanks