Ouzo\Db\WhereClause\WhereClause::create PHP Method

create() public static method

public static create ( $where, $parameters = [] )
    public static function create($where, $parameters = array())
    {
        if (is_null($where)) {
            return new EmptyWhereClause();
        }
        if ($where instanceof WhereClause) {
            return $where;
        }
        if (is_array($where)) {
            return new ArrayWhereClause($where, 'AND');
        }
        if (is_string($where)) {
            return new SqlWhereClause($where, $parameters);
        }
        throw new InvalidArgumentException("Cannot create a WhereClause for given arguments");
    }

Usage Example

示例#1
0
 public function getCondition()
 {
     if (is_callable($this->condition)) {
         return call_user_func($this->condition);
     }
     return WhereClause::create($this->condition);
 }
All Usage Examples Of Ouzo\Db\WhereClause\WhereClause::create