src/Service/Cdn.php
public function getObjects($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('o.id, o.filename, o.filename_display, o.serves, o.downloads, o.thumbs, o.scales, o.driver, o.md5_hash');
        $oDb->Select('o.created, o.created_by, o.modified, o.modified_by');
        $oDb->select('o.mime, o.filesize, o.img_width, o.img_height, o.img_orientation, o.is_animated');
        $oDb->select('b.id bucket_id, b.label bucket_label, b.slug bucket_slug');

        $oDb->join(NAILS_DB_PREFIX . 'cdn_bucket b', 'b.id = o.bucket_id', 'LEFT');

        // --------------------------------------------------------------------------

        //  Apply common items; pass $data
        $this->getCountCommonObjects($data);

        // --------------------------------------------------------------------------

        //  Facilitate pagination
        if (!is_null($page)) {

            /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */

            $page--;
            $page = $page < 0 ? 0 : $page;

            //  Work out what the offset should be
            $perPage = is_null($perPage) ? 50 : (int) $perPage;
            $offset  = $page * $perPage;

            $oDb->limit($perPage, $offset);
        }

        // --------------------------------------------------------------------------

        $objects    = $oDb->get(NAILS_DB_PREFIX . 'cdn_object o')->result();
        $numObjects = count($objects);

        for ($i = 0; $i < $numObjects; $i++) {
            $this->formatObject($objects[$i]);
        }

        return $objects;
    }
public function getObjects($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('o.id, o.filename, o.filename_display, o.serves, o.downloads, o.thumbs, o.scales, o.driver, o.md5_hash');
        $oDb->Select('o.created, o.created_by, o.modified, o.modified_by');
        $oDb->select('o.mime, o.filesize, o.img_width, o.img_height, o.img_orientation, o.is_animated');
        $oDb->select('b.id bucket_id, b.label bucket_label, b.slug bucket_slug');

        $oDb->join(NAILS_DB_PREFIX . 'cdn_bucket b', 'b.id = o.bucket_id', 'LEFT');

        // --------------------------------------------------------------------------

        //  Apply common items; pass $data
        $this->getCountCommonObjects($data);

        // --------------------------------------------------------------------------

        //  Facilitate pagination
        if (!is_null($page)) {

            /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */

            $page--;
            $page = $page < 0 ? 0 : $page;

            //  Work out what the offset should be
            $perPage = is_null($perPage) ? 50 : (int) $perPage;
            $offset  = $page * $perPage;

            $oDb->limit($perPage, $offset);
        }

        // --------------------------------------------------------------------------

        $objects    = $oDb->get(NAILS_DB_PREFIX . 'cdn_object o')->result();
        $numObjects = count($objects);

        for ($i = 0; $i < $numObjects; $i++) {
            $this->formatObject($objects[$i]);
        }

        return $objects;
    }
public function getObjects ( $ page = null , $ perPage = null , $ data = [ ] ) { $ oDb = Factory :: service ( 'Database' ) ; $ oDb -> select ( 'o.id, o.filename, o.filename_display, o.serves, o.downloads, o.thumbs, o.scales, o.driver, o.md5_hash' ) ; $ oDb -> Select ( 'o.created, o.created_by, o.modified, o.modified_by' ) ; $ oDb -> select ( 'o.mime, o.filesize, o.img_width, o.img_height, o.img_orientation, o.is_animated' ) ; $ oDb -> select ( 'b.id bucket_id, b.label bucket_label, b.slug bucket_slug' ) ; $ oDb -> join ( NAILS_DB_PREFIX . 'cdn_bucket b' , 'b.id = o.bucket_id' , 'LEFT' ) ; // -------------------------------------------------------------------------- //  Apply common items; pass $data $ this -> getCountCommonObjects ( $ data ) ; // -------------------------------------------------------------------------- //  Facilitate pagination if ( ! is_null ( $ page ) ) { /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */ $ page -- ; $ page = $ page < 0 ? 0 : $ page ; //  Work out what the offset should be $ perPage = is_null ( $ perPage ) ? 50 : ( int ) $ perPage ; $ offset = $ page * $ perPage ; $ oDb -> limit ( $ perPage , $ offset ) ; } // -------------------------------------------------------------------------- $ objects = $ oDb -> get ( NAILS_DB_PREFIX . 'cdn_object o' ) -> result ( ) ; $ numObjects = count ( $ objects ) ; for ( $ i = 0 ; $ i < $ numObjects ; $ i ++ ) { $ this -> formatObject ( $ objects [ $ i ] ) ; } return $ objects ; }
Returns an array of objects

@param integer $page    The page to return
@param integer $perPage The number of items to return per page
@param array   $data    An array of data to pass to getCountCommonBuckets()

@return array
Returns an array of objects