protected function formatObject(
        &$oObj,
        array $aData = [],
        array $aIntegers = [],
        array $aBools = [],
        array $aFloats = []
    ) {

        parent::formatObject($oObj, $aData, $aIntegers, $aBools, $aFloats);

        if (!empty($oObj->item_id)) {
            $oObj->item_id = (int) $oObj->item_id;
        }

        $oObj->changes = @json_decode($oObj->changes);
        $oObj->user    = (object) [
            'id'          => $oObj->user_id,
            'first_name'  => isset($oObj->first_name) ? $oObj->first_name : '',
            'last_name'   => isset($oObj->last_name) ? $oObj->last_name : '',
            'gender'      => isset($oObj->gender) ? $oObj->gender : '',
            'profile_img' => isset($oObj->profile_img) ? $oObj->profile_img : '',
            'email'       => isset($oObj->email) ? $oObj->email : '',
        ];

        unset($oObj->user_id);
        unset($oObj->first_name);
        unset($oObj->last_name);
        unset($oObj->gender);
        unset($oObj->profile_img);
        unset($oObj->email);
    }
protected function formatObject(
        &$oObj,
        array $aData = [],
        array $aIntegers = [],
        array $aBools = [],
        array $aFloats = []
    ) {

        parent::formatObject($oObj, $aData, $aIntegers, $aBools, $aFloats);

        if (!empty($oObj->item_id)) {
            $oObj->item_id = (int) $oObj->item_id;
        }

        $oObj->changes = @json_decode($oObj->changes);
        $oObj->user    = (object) [
            'id'          => $oObj->user_id,
            'first_name'  => isset($oObj->first_name) ? $oObj->first_name : '',
            'last_name'   => isset($oObj->last_name) ? $oObj->last_name : '',
            'gender'      => isset($oObj->gender) ? $oObj->gender : '',
            'profile_img' => isset($oObj->profile_img) ? $oObj->profile_img : '',
            'email'       => isset($oObj->email) ? $oObj->email : '',
        ];

        unset($oObj->user_id);
        unset($oObj->first_name);
        unset($oObj->last_name);
        unset($oObj->gender);
        unset($oObj->profile_img);
        unset($oObj->email);
    }
protected function formatObject ( & $ oObj , array $ aData = [ ] , array $ aIntegers = [ ] , array $ aBools = [ ] , array $ aFloats = [ ] ) { parent :: formatObject ( $ oObj , $ aData , $ aIntegers , $ aBools , $ aFloats ) ; if ( ! empty ( $ oObj -> item_id ) ) { $ oObj -> item_id = ( int ) $ oObj -> item_id ; } $ oObj -> changes = @ json_decode ( $ oObj -> changes ) ; $ oObj -> user = ( object ) [ 'id' => $ oObj -> user_id , 'first_name' => isset ( $ oObj -> first_name ) ? $ oObj -> first_name : '' , 'last_name' => isset ( $ oObj -> last_name ) ? $ oObj -> last_name : '' , 'gender' => isset ( $ oObj -> gender ) ? $ oObj -> gender : '' , 'profile_img' => isset ( $ oObj -> profile_img ) ? $ oObj -> profile_img : '' , 'email' => isset ( $ oObj -> email ) ? $ oObj -> email : '' , ] ; unset ( $ oObj -> user_id ) ; unset ( $ oObj -> first_name ) ; unset ( $ oObj -> last_name ) ; unset ( $ oObj -> gender ) ; unset ( $ oObj -> profile_img ) ; unset ( $ oObj -> email ) ; }
Formats a single object

The getAll() method iterates over each returned item with this method so as to
correctly format the output. Use this to cast integers and booleans and/or organise data into objects.

@param  object $oObj      A reference to the object being formatted.
@param  array  $aData     The same data array which is passed to _getcount_common, for reference if needed
@param  array  $aIntegers Fields which should be cast as integers if numerical and not null
@param  array  $aBools    Fields which should be cast as booleans if not null
@param  array  $aFloats   Fields which should be cast as floats if not null
Formats a single object