SelectQuery::__construct PHP Method

__construct() public method

SelectQuery constructor.
public __construct ( FluentPDO $fpdo, $from )
$fpdo FluentPDO
$from
    function __construct(FluentPDO $fpdo, $from)
    {
        $clauses = array('SELECT' => ', ', 'FROM' => null, 'JOIN' => array($this, 'getClauseJoin'), 'WHERE' => ' AND ', 'GROUP BY' => ',', 'HAVING' => ' AND ', 'ORDER BY' => ', ', 'LIMIT' => null, 'OFFSET' => null, "\n--" => "\n--");
        parent::__construct($fpdo, $clauses);
        // initialize statements
        $fromParts = explode(' ', $from);
        $this->fromTable = reset($fromParts);
        $this->fromAlias = end($fromParts);
        $this->statements['FROM'] = $from;
        $this->statements['SELECT'][] = $this->fromAlias . '.*';
        $this->joins[] = $this->fromAlias;
        if (isset($fpdo->convertTypes) && $fpdo->convertTypes) {
            $this->convertTypes = true;
        }
    }

Usage Example

Exemplo n.º 1
0
 public function __construct($dbobject)
 {
     if (property_exists($dbobject, 'per_page')) {
         $this->per_page = $dbobject::$per_page;
     }
     parent::__construct($dbobject);
 }