/** * @param Select $select * * @return array */ public function writeSelectsAsColumns(Select $select) { $selectAsColumns = $select->getColumnSelects(); if (!empty($selectAsColumns)) { $selectWriter = WriterFactory::createSelectWriter($this->writer, $this->placeholderWriter); $selectAsColumns = $this->selectColumnToQuery($selectAsColumns, $selectWriter); } return $selectAsColumns; }
/** * @param $subject * * @return string */ protected function writeWherePartialCondition(&$subject) { if ($subject instanceof Column) { $str = $this->columnWriter->writeColumn($subject); } elseif ($subject instanceof Select) { $selectWriter = WriterFactory::createSelectWriter($this->writer, $this->placeholderWriter); $str = '(' . $selectWriter->write($subject) . ')'; } else { $str = $this->writer->writePlaceholderValue($subject); } return $str; }
/** * @test */ public function itShouldCreateSelectWriter() { $writer = WriterFactory::createSelectWriter($this->writer, $this->placeholder); $this->assertSame('NilPortugues\\Sql\\QueryBuilder\\Builder\\Syntax\\SelectWriter', \get_class($writer)); }