PodioItem::calculate - (object): must be array



1 comment

  • Andreas Haugstrup Pedersen

    Hi Alexander,

    You can see in the reference documentation that the 'filters', 'formula' (and 'grouping') sections are arrays of objects. In your case you're just passing an object (a PHP associative array will become an object when serialized to json).

    So the first step is to wrap them in another array:

    $calc = PodioItem::calculate( _APP_ID_, array(

    'aggregation' => 'sum',

    'formula' => array(array('field' => _MONEY_FIELD_ID_)),

    'filters' => array(array(_APP_REFERENCE_FIELD_ID_ => array($student_id))),

    ) );

    When working with complex attributes arrays it can be a good idea to run your attributes through json_encode() to make sure you have the json serialization you think you have...

    All the best,


    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk