private function addModelToArray($models, $model)
    {
        $apply_to_models = array();
        
        if (count($models) > 0) {
            foreach ($models as $item_json) {
                $item = json_decode($item_json);
                $object = $model->find($item->id);
                if ($object != null) {
                    for ($count = 1; $count <= $item->quantity; $count++) {
                        $apply_to_models[] = $object;
                    }
                }
            }
        }
        
        return $apply_to_models;
    }
private function addModelToArray($models, $model)
    {
        $apply_to_models = array();
        
        if (count($models) > 0) {
            foreach ($models as $item_json) {
                $item = json_decode($item_json);
                $object = $model->find($item->id);
                if ($object != null) {
                    for ($count = 1; $count <= $item->quantity; $count++) {
                        $apply_to_models[] = $object;
                    }
                }
            }
        }
        
        return $apply_to_models;
    }
private function addModelToArray ( $ models , $ model ) { $ apply_to_models = array ( ) ; if ( count ( $ models ) > 0 ) { foreach ( $ models as $ item_json ) { $ item = json_decode ( $ item_json ) ; $ object = $ model -> find ( $ item -> id ) ; if ( $ object != null ) { for ( $ count = 1 ; $ count <= $ item -> quantity ; $ count ++ ) { $ apply_to_models [ ] = $ object ; } } } } return $ apply_to_models ; }
Add model to array, content is JSON string

@param array $models
@param object $model Model

@return array
Add model to array content is JSON string