$columnMap = $dataMap->getColumnMap($propertyName);
$childClassName = $columnMap->getChildClassName();
$propertyMetaData = $classSchema->getProperty($propertyName);
- if (!empty($childClassName)) {
- $propertyType = $childClassName;
- } elseif (!empty($propertyMetaData['type'])) {
- $propertyType = $propertyMetaData['type'];
- } else {
- throw new Tx_Extbase_Persistence_Exception_UnexpectedTypeException('Could not determine the class of the child objects.', 1251315965);
- }
-
+ $propertyType = $propertyMetaData['type'];
// FIXME enable property-type check
// $this->checkPropertyType($propertyType, $propertyValue);
- if (($propertyValue !== NULL) && $propertyType === 'Tx_Extbase_Persistence_ObjectStorage') {
+ if (($propertyValue !== NULL) && ($propertyValue instanceof Tx_Extbase_Persistence_ObjectStorage || $propertyType === 'Tx_Extbase_Persistence_ObjectStorage')) {
if ($object->_isNew() || $object->_isDirty($propertyName)) {
$this->persistObjectStorage($propertyValue, $object, $propertyName, $queue, $row);
}
* @return void
*/
protected function fetchRelatedEager(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $fieldValue = '') {
+ if ($fieldValue === '') return array();
$query = $this->getPreparedQuery($parentObject, $propertyName, $fieldValue);
return $query->execute();
}
$childSortByFieldName = $columnMap->getChildSortByFieldName();
if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
$query = $queryFactory->create($this->getType($parentObject, $propertyName));
- $result = $query->matching($query->withUid(intval($fieldValue)));
+ $query->matching($query->withUid(intval($fieldValue)));
} elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
$query = $queryFactory->create($this->getElementType($parentObject, $propertyName));
// TODO: This is an ugly hack, just ignoring the storage page state from here. Actually, the query settings would have to be passed into the DataMapper, so we can respect
$query->setOrderings(array($childSortByFieldName => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
}
if (isset($parentKeyFieldName)) {
- $result = $query->matching($query->equals($parentKeyFieldName, $parentObject->getUid()));
+ $query->matching($query->equals($parentKeyFieldName, $parentObject->getUid()));
} else {
- $result = $query->matching($query->equals('uid', t3lib_div::intExplode(',', $fieldValue)));
+ $query->matching($query->equals('uid', t3lib_div::intExplode(',', $fieldValue)));
}
} elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
$query = $queryFactory->create($this->getElementType($parentObject, $propertyName));
if (!empty($childSortByFieldName)) {
$query->setOrderings(array($relationTableName . '.' . $childSortByFieldName => Tx_Extbase_Persistence_QueryInterface::ORDER_ASCENDING));
}
- $result = $query->matching($query->equals($parentKeyFieldName, $parentObject->getUid()));
+ $query->matching($query->equals($parentKeyFieldName, $parentObject->getUid()));
} else {
throw new Tx_Extbase_Persistence_Exception('Could not determine type of relation.', 1252502725);
}