Example #1
0
 /**
  * {@inheritDoc}
  * @see \Fixin\Model\Storage\Grammar\GrammarInterface::insertInto($repository, $request)
  */
 public function insertInto(RepositoryInterface $repository, RequestInterface $request) : QueryInterface
 {
     $query = $this->container->clonePrototype(static::PROTOTYPE_QUERY)->appendWord(static::STATEMENT_INSERT)->appendClause(static::CLAUSE_INTO, $this->quoteIdentifier($repository->getName()));
     // Columns
     if ($columns = $request->getColumns()) {
         $list = [];
         foreach ($columns as $alias => $identifier) {
             $list[] = $this->identifierToString(is_numeric($alias) ? $identifier : $alias, $query);
         }
         $query->appendString(sprintf(static::MASK_COLUMN_NAMES, implode(static::LIST_SEPARATOR, $list)));
     }
     // Select
     $query->appendString($this->requestToString($request, $query));
     return $query;
 }