예제 #1
0
파일: Grammar.php 프로젝트: fixin/fixin
 /**
  * {@inheritDoc}
  * @see \Fixin\Model\Storage\Grammar\GrammarInterface::insertMultiple($repository, $rows)
  */
 public function insertMultiple(RepositoryInterface $repository, array $rows) : QueryInterface
 {
     $query = $this->container->clonePrototype(static::PROTOTYPE_QUERY)->appendWord(static::STATEMENT_INSERT)->appendClause(static::CLAUSE_INTO, $this->quoteIdentifier($repository->getName()));
     $columnNames = [];
     foreach (array_keys(reset($rows)) as $identifier) {
         $columnNames[] = $this->identifierToString($identifier, $query);
     }
     $query->appendString(sprintf(static::MASK_COLUMN_NAMES, implode(static::LIST_SEPARATOR, $columnNames)));
     $source = [];
     foreach ($rows as $set) {
         $values = [];
         foreach ($set as $value) {
             $values[] = $this->expressionToString($value, $query);
         }
         $source[] = sprintf(static::MASK_VALUES, implode(static::LIST_SEPARATOR, $values));
     }
     return $query->appendClause(static::CLAUSE_VALUES, implode(static::LIST_SEPARATOR_MULTI_LINE, $source));
 }
예제 #2
0
파일: Cache.php 프로젝트: fixin/fixin
 /**
  * Set repository
  *
  * @param RepositoryInterface $repository
  */
 protected function setRepository(RepositoryInterface $repository)
 {
     $this->repository = $repository;
     $this->primaryKeyFlipped = array_flip($repository->getPrimaryKey());
 }
예제 #3
0
파일: RequestBase.php 프로젝트: fixin/fixin
 /**
  * {@inheritDoc}
  * @see \Fixin\Model\Request\RequestInterface::getAlias()
  */
 public function getAlias() : string
 {
     return $this->alias ?? ($this->alias = $this->repository->getName());
 }