Example #1
0
 /**
  * Returns the current field value of the given object property from the storage backend.
  *
  * @param Tx_Extbase_DomainObject_DomainObjectInterface $object The object
  * @param string $propertyName The property name
  * @return mixed The field value
  */
 protected function getCurrentFieldValue(Tx_Extbase_DomainObject_DomainObjectInterface $object, $propertyName)
 {
     $className = get_class($object);
     $columnMap = $this->dataMapper->getDataMap($className)->getColumnMap($propertyName);
     $query = $this->queryFactory->create($className);
     $query->getQuerySettings()->setReturnRawQueryResult(TRUE);
     $currentRow = $query->matching($query->withUid($object->getUid()))->execute()->getFirst();
     $fieldValue = $currentRow[$columnMap->getColumnName()];
     return $fieldValue;
 }
Example #2
0
 /**
  * Returns a query for objects of this repository
  *
  * @return Tx_Extbase_Persistence_QueryInterface
  * @api
  */
 public function createQuery()
 {
     $query = $this->queryFactory->create($this->objectType);
     if ($this->defaultOrderings !== array()) {
         $query->setOrderings($this->defaultOrderings);
     }
     if ($this->defaultQuerySettings !== NULL) {
         $query->setQuerySettings($this->defaultQuerySettings);
     }
     return $query;
 }
Example #3
0
 /**
  * Builds and returns the prepared query, ready to be executed.
  *
  * @param Tx_Extbase_DomainObject_DomainObjectInterface $parentObject
  * @param string $propertyName
  * @param string $fieldValue
  * @return void
  */
 protected function getPreparedQuery(Tx_Extbase_DomainObject_DomainObjectInterface $parentObject, $propertyName, $fieldValue = '')
 {
     $columnMap = $this->getDataMap(get_class($parentObject))->getColumnMap($propertyName);
     $type = $this->getType(get_class($parentObject), $propertyName);
     $query = $this->queryFactory->create($type);
     $query->getQuerySettings()->setRespectStoragePage(FALSE);
     if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
         if ($columnMap->getChildSortByFieldName() !== NULL) {
             $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
         }
     } elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
         $query->setSource($this->getSource($parentObject, $propertyName));
         if ($columnMap->getChildSortByFieldName() !== NULL) {
             $query->setOrderings(array($columnMap->getChildSortByFieldName() => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
         }
     }
     $query->matching($this->getConstraint($query, $parentObject, $propertyName, $fieldValue, $columnMap->getRelationTableMatchFields()));
     return $query;
 }
 /**
  * Returns a query for objects of this repository
  *
  * @return Tx_Extbase_Persistence_QueryInterface
  * @api
  */
 public function createQuery()
 {
     return $this->queryFactory->create($this->objectType);
 }