/** * @return string */ public function getWhereOperator() { if (!isset($this->where)) { $this->where = $this->filter(); } return $this->where->getConjunction(); }
/** * @test */ public function itShouldSetNotExistsCondition() { $select1 = new Select('user'); $select1->where()->equals('user_id', 10); $result = $this->where->notExists($select1)->getNotExists(); $this->assertEquals(array($select1), $result); }
/** * Applies a Criteria in the SQL Instruction * * @param Where $where Where Operator * @param array $criteria SQL Criteria * @return Where Final Operator */ private function getCriteria(Where $where, array $criteria) { foreach ($criteria as $property => $value) { $where->equals($property, $value); } $where->equals('DELETED', 0); return $where; }
/** * @test */ public function itShouldReturnLiterals() { $result = $this->where->asLiteral('(username is not null and status=:status)')->getComparisons(); $this->assertSame('(username is not null and status=:status)', $result[0]); }
/** * @param Where $where * @param array $whereArray * * @return array */ protected function writeSubWheres(Where $where, array &$whereArray) { $subWheres = $where->getSubWheres(); array_walk($subWheres, function (&$subWhere) { $subWhere = "({$this->writeWhere($subWhere)})"; }); $whereArray = array_merge($whereArray, $subWheres); }
/** * @param Where $where * @param array $whereArray * * @return array */ public function writeSubWheres(Where $where, array &$whereArray) { $subWheres = $where->getSubWheres(); $me = $this; array_walk($subWheres, function (&$subWhere) use($me) { $subWhere = "({$me->writeWhere($subWhere)})"; }); $whereArray = array_merge($whereArray, $subWheres); }