When trying to execute an overloaded method of a .net class I always get the error that the number of parameters is incorrect.
.net code :
public bool AddStock(double AWidth, double AHeight, int aCount)
{
return this.Manager.(AWidth, AHeight, aCount, string.Empty, 0);
}
public bool AddStock(double AWidth, double AHeight, int aCount, string aID)
{
return this.Manager.(AWidth, AHeight, aCount, aID, 0);
}
public bool AddStock(double AWidth, double AHeight)
{
return this.AddStock(AWidth, AHeight, 1);
}
In PHP :
This works :
$e->AddStock(2440, 1220, 1);
This doesn't :
$e->AddStock(2440, 1220, 1, 'Test');
Fatal error: Uncaught com_exception: Error [0x8002000e] Invalid number of parameters.
After lots of Googling I found that overloaded methods are accessible if you add an underscore and a number.
The solution was to
$e->AddStock_3(2440, 1220, 1, 'Test');
User contributions licensed under CC BY-SA 3.0