public function testIsEmpty() { $where = new Where(new Identifier('hello')); $this->assertSame(false, $where->isEmpty()); $where = new Where(); $this->assertSame(true, $where->isEmpty()); $where->addAnd(new Identifier('hello')); $this->assertSame(false, $where->isEmpty()); }
/** * * @param mixed $type * @param Literal|string $table * @param mixed $condition * @return $this * @throws Exception */ private function join($type, $table, $condition) { $tableExpression = null; if ($table instanceof Literal) { $tableExpression = $table; } elseif (is_string($table)) { $tableExpression = new Identifier($table); } else { throw new Exception('Table name or Literal expected'); } $condArgs = array_slice(func_get_args(), 2); $joinCondition = WhereUpdateCommon::extractExpressions($condArgs); $where = new Where(); foreach ($joinCondition as $jc) { $where->addAnd($jc); } $info = new JoinInfo($type, $tableExpression, $where->getExpression()); $this->joins[] = $info; return $this; }