Model/Base.php
private function comList($result)
    {
        foreach ($result as $res) {
            $data[$res->get('id')]['title'] = $res->get('title');
            $data[$res->get('id')]['resume'] = $res->get('resume');
            $data[$res->get('id')]['author'] = $res->get('author');
            $data[$res->get('id')]['autor'] = $res->get('autor');
            $data[$res->get('id')]['category'] = $res->get('category');
            $data[$res->get('id')]['categoria'] = $res->get('categoria');
            $data[$res->get('id')]['link'] = $res->get('link');
            $data[$res->get('id')]['pubdate'] = $res->get('pubdate');
            //$data[$res->get('id')]['image'] = ['type'=>'picture', 'src'=>'/media/blog.png'];

            $media = json_decode($res->get('media'));

            foreach ($media as $img) {
                if (isset($img->type) && $img->type == 'image') {
                    $data[$res->get('id')]['image'] = '/media/article/'.$res->get('id').'/mini_'.basename($img->src);
                    break;
                }

                if (isset($img->type) && $img->type == 'video') {
                    $data[$res->get('id')]['image'] = '/media/v.png';
                }
            }
        }
    
        return $data;
    }
private function comList($result)
    {
        foreach ($result as $res) {
            $data[$res->get('id')]['title'] = $res->get('title');
            $data[$res->get('id')]['resume'] = $res->get('resume');
            $data[$res->get('id')]['author'] = $res->get('author');
            $data[$res->get('id')]['autor'] = $res->get('autor');
            $data[$res->get('id')]['category'] = $res->get('category');
            $data[$res->get('id')]['categoria'] = $res->get('categoria');
            $data[$res->get('id')]['link'] = $res->get('link');
            $data[$res->get('id')]['pubdate'] = $res->get('pubdate');
            //$data[$res->get('id')]['image'] = ['type'=>'picture', 'src'=>'/media/blog.png'];

            $media = json_decode($res->get('media'));

            foreach ($media as $img) {
                if (isset($img->type) && $img->type == 'image') {
                    $data[$res->get('id')]['image'] = '/media/article/'.$res->get('id').'/mini_'.basename($img->src);
                    break;
                }

                if (isset($img->type) && $img->type == 'video') {
                    $data[$res->get('id')]['image'] = '/media/v.png';
                }
            }
        }
    
        return $data;
    }
private function comList ( $ result ) { foreach ( $ result as $ res ) { $ data [ $ res -> get ( 'id' ) ] [ 'title' ] = $ res -> get ( 'title' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'resume' ] = $ res -> get ( 'resume' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'author' ] = $ res -> get ( 'author' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'autor' ] = $ res -> get ( 'autor' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'category' ] = $ res -> get ( 'category' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'categoria' ] = $ res -> get ( 'categoria' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'link' ] = $ res -> get ( 'link' ) ; $ data [ $ res -> get ( 'id' ) ] [ 'pubdate' ] = $ res -> get ( 'pubdate' ) ; //$data[$res->get('id')]['image'] = ['type'=>'picture', 'src'=>'/media/blog.png']; $ media = json_decode ( $ res -> get ( 'media' ) ) ; foreach ( $ media as $ img ) { if ( isset ( $ img -> type ) && $ img -> type == 'image' ) { $ data [ $ res -> get ( 'id' ) ] [ 'image' ] = '/media/article/' . $ res -> get ( 'id' ) . '/mini_' . basename ( $ img -> src ) ; break ; } if ( isset ( $ img -> type ) && $ img -> type == 'video' ) { $ data [ $ res -> get ( 'id' ) ] [ 'image' ] = '/media/v.png' ; } } } return $ data ; }
Private util function

@param  array $result Array of the Row object

@return array result data
Private util function