コード例 #1
0
 /**
  * @test
  */
 public function itShouldCreateWhereObject()
 {
     $mockClass = '\\NilPortugues\\Sql\\QueryBuilder\\Manipulation\\QueryInterface';
     $query = $this->getMockBuilder($mockClass)->disableOriginalConstructor()->getMock();
     $className = '\\NilPortugues\\Sql\\QueryBuilder\\Syntax\\Where';
     $this->assertInstanceOf($className, QueryFactory::createWhere($query));
 }
コード例 #2
0
 /**
  * @return Where
  */
 protected function filter()
 {
     if (!isset($this->where)) {
         $this->where = QueryFactory::createWhere($this);
     }
     return $this->where;
 }
コード例 #3
0
 /**
  * WHERE constrains used for the ON clause of a (LEFT/RIGHT/INNER/CROSS) JOIN.
  *
  * @return Where
  */
 public function joinCondition()
 {
     if (!isset($this->joinCondition)) {
         $this->joinCondition = QueryFactory::createWhere($this->select);
     }
     return $this->joinCondition;
 }
コード例 #4
0
 /**
  * @param $havingOperator
  *
  * @throws QueryException
  * @return Where
  */
 public function having($havingOperator = 'AND')
 {
     if (!isset($this->having)) {
         $this->having = QueryFactory::createWhere($this);
     }
     if (!in_array($havingOperator, array(Where::CONJUNCTION_AND, Where::CONJUNCTION_OR))) {
         throw new QueryException("Invalid conjunction specified, must be one of AND or OR, but '" . $havingOperator . "' was found.");
     }
     $this->havingOperator = $havingOperator;
     return $this->having;
 }
コード例 #5
0
ファイル: Where.php プロジェクト: masnathan/sql-query-builder
 /**
  * @param $operator
  *
  * @return Where
  */
 public function subWhere($operator = 'OR')
 {
     /** @var Where $filter */
     $filter = QueryFactory::createWhere($this->query);
     $filter->conjunction($operator);
     $filter->setTable($this->getTable());
     $this->subWheres[] = $filter;
     return $filter;
 }
コード例 #6
0
 /**
  * @param \NilPortugues\Sql\QueryBuilder\Manipulation\Select $first
  * @param \NilPortugues\Sql\QueryBuilder\Manipulation\Select $second
  *
  * @return \NilPortugues\Sql\QueryBuilder\Manipulation\Minus
  */
 public function minus(Select $first, Select $second)
 {
     return QueryFactory::createMinus($first, $second);
 }