When learning or debugging the StrikeIron services, it's often useful to dump the
result returned from a method call. The result will always be an object that is an
instance of Zend_Service_StrikeIron_Decorator. This is a
small decorator
object that wraps the results from the method call.
The simplest way to examine a result from the service is to use the built-in PHP functions like print_r():
<?php
$strikeIron = new Zend_Service_StrikeIron(array('username' => 'your-username',
'password' => 'your-password'));
$taxBasic = $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));
$rateInfo = $taxBasic->getTaxRateCanada(array('province' => 'ontario'));
print_r($rateInfo);
?>
Zend_Service_StrikeIron_Decorator Object
(
[_name:protected] => GetTaxRateCanadaResult
[_object:protected] => stdClass Object
(
[abbreviation] => ON
[province] => ONTARIO
[GST] => 0.06
[PST] => 0.08
[total] => 0.14
[HST] => Y
)
)
In the output above, we see that the decorator ($rateInfo) wraps an
object named GetTaxRateCanadaResult, the result of the call to
getTaxRateCanada().
This means that $rateInfo has public properties like
abbreviation, province, and
GST. These are accessed like
$rateInfo->province.
Tip
StrikeIron result properties sometimes start with an uppercase letter such as Foo or Bar where most PHP object properties normally start with a lowercase letter as in foo or bar. The decorator will automatically do this inflection so you may read a property Foo as foo.
If you ever need to get the original object or its name out of the decorator, use the
respective methods getDecoratedObject() and
getDecoratedObjectName().




