Actions

Source Code of This Project

/lib/model/DBuilder/Model/Portfolio.php

<?php
/*
 * This file is part of the pwp package.
 * (c) 2009-2010 Victor Rad' <victor.v.rad[at]gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
*/

/**
 * See DBuilder
 *
 * @package    pwp
 * @subpackage DBuilder
 * @author     Victor Rad'
 */
class DBuilder_Model_Portfolio extends DBuilder
{
    public function __construct(DBuilder_Query $query, $indexBy = null)
    {
        parent::__construct($query);
        // do base request
        $this->getQuery()->from('Portfolio p' . ((null !== $indexBy) ? ' INDEXBY r.' . $indexBy : ''))->select('p.*');
    }

    public function jointImages()
    {
        // check and prepare data
        $q = $this->getQuery();

        $q->addSelect('i.*')
            ->leftJoin('p.Images i');

        return $this;
    }

    public function reorganize()
    {
        // check and prepare data
        $q = $this->getQuery();
        // design query
        $q->orderBy('p.sort DESC, i.sort DESC');

        return $this;
    }



}