src/PicORM/Model.php
public static function select(
        $fields = array('*'),
        $where = array(),
        $order = array(),
        $limitStart = null,
        $limitEnd = null,
        $pdoFetchMode = null
    )
    {
        // validate model PHP structure if necessary
        static::_validateModel();

        // build and execute query
        $mysqlQuery = static::buildSelectQuery($fields, $where, $order, $limitStart, $limitEnd);
        $query      = static::$_dataSource->prepare($mysqlQuery->buildQuery());
        $query->execute($mysqlQuery->getWhereParamsValues());

        // check for mysql error
        $errorcode = $query->errorInfo();
        if ($errorcode[0] != "00000") {
            throw new Exception($errorcode[2]);
        }

        // if no fetch mode specified fallback to FETCH_ASSOC
        if ($pdoFetchMode === null) {
            $pdoFetchMode = \PDO::FETCH_ASSOC;
        }

        // if limit say its a findOne only fetch
        if ($limitStart == 1 && ($limitEnd === null || $limitEnd === 1)) {
            return $query->fetch($pdoFetchMode);
        }

        // fetch and return data from database
        return $query->fetchAll($pdoFetchMode);
    }
public static function select(
        $fields = array('*'),
        $where = array(),
        $order = array(),
        $limitStart = null,
        $limitEnd = null,
        $pdoFetchMode = null
    )
    {
        // validate model PHP structure if necessary
        static::_validateModel();

        // build and execute query
        $mysqlQuery = static::buildSelectQuery($fields, $where, $order, $limitStart, $limitEnd);
        $query      = static::$_dataSource->prepare($mysqlQuery->buildQuery());
        $query->execute($mysqlQuery->getWhereParamsValues());

        // check for mysql error
        $errorcode = $query->errorInfo();
        if ($errorcode[0] != "00000") {
            throw new Exception($errorcode[2]);
        }

        // if no fetch mode specified fallback to FETCH_ASSOC
        if ($pdoFetchMode === null) {
            $pdoFetchMode = \PDO::FETCH_ASSOC;
        }

        // if limit say its a findOne only fetch
        if ($limitStart == 1 && ($limitEnd === null || $limitEnd === 1)) {
            return $query->fetch($pdoFetchMode);
        }

        // fetch and return data from database
        return $query->fetchAll($pdoFetchMode);
    }
Build a select mysql query for this model from criteria in parameters
return a raw mysql fetch assoc
Using Raw SQL _setVal, assume that you properly filter user input

@param array $fields       - selected fields
@param array $where        - associative array ex:
simple criteria       array('idMarque' => 1)
custom operator       array('idMarque' => array('operator' => '<=','value' => '5'))
raw SQL without operator       array('idMarque' => array('IN (5,6,4)')
@param array $order        - associative array ex:array('libMarque'=>'ASC')
@param int   $limitStart   - int
@param int   $limitEnd     - int
@param int   $pdoFetchMode - PDO Fetch Mode (default : \PDO::FETCH_ASSOC)

@return array
@throws Exception