예제 #1
0
 /**
  * Конструктор.
  * @param IQueryBuilder $query запрос
  * @param array $resultVariables массив переменных, связанных с результатом
  */
 public function __construct(IQueryBuilder $query, array $resultVariables)
 {
     $this->connection = $query->getConnection();
     $this->pdoStatement = $query->getPDOStatement();
     $this->resultVariables = $resultVariables;
     $this->fetchAll();
 }
예제 #2
0
 /**
  * {@inheritdoc}
  */
 public function persistProperty(IObject $object, IProperty $property, IQueryBuilder $builder)
 {
     if ($builder instanceof IUpdateBuilder) {
         $increment = $property->getDbValue() - $property->getPersistedDbValue();
         if ($increment !== 0) {
             $incrementExpression = $builder->getConnection()->quoteIdentifier($this->getColumnName()) . ' + (' . $increment . ')';
             $builder->set($this->getColumnName(), ':new' . $this->getColumnName())->bindExpression(':new' . $this->getColumnName(), $incrementExpression);
         }
     }
     return $this;
 }
예제 #3
0
 /**
  * @see IField::persistProperty()
  */
 public function persistProperty(IObject $object, IProperty $property, IQueryBuilder $builder)
 {
     if ($builder instanceof IUpdateBuilder) {
         $localeId = $property->getLocaleId();
         if ($localeId && !$this->hasLocale($localeId)) {
             return $this;
         }
         $builder->set($this->getColumnName($localeId));
         $value = $this->calculateDBValue($object, $localeId);
         $builder->bindValue(':' . $this->getColumnName($localeId), $value, $this->getDataType());
         $property->setValue($value);
     }
     return $this;
 }
예제 #4
0
 /**
  * {@inheritdoc}
  */
 public function persistProperty(IObject $object, IProperty $property, IQueryBuilder $builder)
 {
     $localeId = $property->getLocaleId();
     if ($localeId && !$this->hasLocale($localeId)) {
         return $this;
     }
     /**
      * @var IUpdateBuilder $builder
      */
     if ($builder instanceof IUpdateBuilder) {
         $increment = $property->getDbValue() - $property->getPersistedDbValue();
         if ($increment !== 0) {
             $incrementExpression = $builder->getConnection()->quoteIdentifier($this->getColumnName()) . ' + (' . $increment . ')';
             $builder->set($this->getColumnName($localeId), ':new' . $this->getColumnName($localeId))->bindExpression(':new' . $this->getColumnName($localeId), $incrementExpression);
         }
     } elseif ($builder instanceof IInsertBuilder) {
         $builder->set($this->getColumnName($localeId));
         $builder->bindValue(':' . $this->getColumnName($localeId), $this->calculateDBValue($object, $localeId), $this->getDataType());
     }
     return $this;
 }
예제 #5
0
 /**
  * {@inheritdoc}
  */
 public function persistProperty(IObject $object, IProperty $property, IQueryBuilder $builder)
 {
     /**
      * @var IUpdateBuilder $builder
      */
     if ($builder instanceof IInsertBuilder || $builder instanceof IUpdateBuilder) {
         $localeId = $property->getLocaleId();
         if ($localeId && !$this->hasLocale($localeId)) {
             return $this;
         }
         $builder->set($this->getColumnName($localeId));
         $builder->bindValue(':' . $this->getColumnName($localeId), $property->getDbValue(), $this->getDataType());
     }
     return $this;
 }