Actions

Source Code of This Project

/lib/model/DBuilder/Filter.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.
*/

/**
 * Base class is a part of DBuilder
 * Its purpose is filtering content.
 * e.g.: by amount, date, status ...
 * builderInstance
 *     ->filter->providers($request)
 *     ->filter->dateRange($request)
 *
 * @package    pwp
 * @subpackage DBuilder
 * @author     Victor Rad'
 */
abstract class DBuilder_Filter
{
    protected
            // returned instance
            $returnInstance = null,
            // DBuilder_Query instance
            $query = null;

    public function __construct(DBuilder_Query $query)
    {
        // assign DBuilder_Query instance
        $this->query = $query;
        $this->returnInstance = $this;
    }

    public function setReturnInstance($returnInstance)
    {
        $this->returnInstance = $returnInstance;
    }

    public function __call($name,  $arguments)
    {
        if (method_exists($this->query, $name)){
            return $this->query->$name($arguments);
        }
    }

}