getValues(); if (empty($values)) { throw new QueryException('No values to update in Update query.'); } $parts = array( 'UPDATE '.$this->writer->writeTable($update->getTable()).' SET ', $this->writeUpdateValues($update), ); AbstractBaseWriter::writeWhereCondition($update, $this->writer, $this->placeholderWriter, $parts); AbstractBaseWriter::writeLimitCondition($update, $this->placeholderWriter, $parts); $comment = AbstractBaseWriter::writeQueryComment($update); return $comment.implode(' ', $parts); } /** * @param Update $update * * @return string */ protected function writeUpdateValues(Update $update) { $assigns = []; foreach ($update->getValues() as $column => $value) { $newColumn = array($column); $column = $this->columnWriter->writeColumn(SyntaxFactory::createColumn($newColumn, $update->getTable())); $value = $this->writer->writePlaceholderValue($value); $assigns[] = "$column = $value"; } return \implode(', ', $assigns); } }