Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Examining Results

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():

= new Zend_Service_StrikeIron(array('username' => 'your-username',
'password' => 'your-password'));

$taxBasic $strikeIron->getService(array('class' => 'SalesUseTaxBasic'));

$rateInfo $taxBasic->getTaxRateCanada(array('province' => 'ontario'));

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.


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().

Zend Framework