[+BUGFIX] Extbase (Persistence): It is now possible to pass an object as operand of a comparison.
*
* @param Tx_Extbase_Persistence_IdentityMap $identityMap
* @return void
-
*/
public function injectIdentityMap(Tx_Extbase_Persistence_IdentityMap $identityMap) {
$this->identityMap = $identityMap;
foreach ($propertyValue as $relatedObject) {
$queuedObjects[$propertyName][] = $relatedObject;
}
- $row[$columnName] = count($propertyValue); // Will be overwritten if the related objects are referenced by a comma separated list
foreach ($this->getDeletedChildObjects($object, $propertyName) as $deletedObject) {
$this->deleteObject($deletedObject, $object, $propertyName, TRUE, FALSE);
}
+ $row[$columnName] = count($propertyValue); // Will be overwritten if the related objects are referenced by a comma separated list
}
} elseif ($propertyValue instanceof Tx_Extbase_DomainObject_DomainObjectInterface) {
// TODO Handle Value Objects different
$className = get_class($object);
$dataMap = $this->dataMapper->getDataMap($className);
foreach ($queuedChildObjects as $propertyName => $childObjects) {
- $childPidArray = array();
$columnMap = $dataMap->getColumnMap($propertyName);
foreach($childObjects as $childObject) {
$this->persistObject($childObject, $object, $propertyName);
}
}
if ($columnMap->getParentKeyFieldName() === NULL) { // TRUE: We have to generate a comma separated list stored in the field
- $row[$propertyName] = implode(',', $childPidArray);
+ if (count($childPidArray) > 0) {
+ $row[$propertyName] = implode(',', $childPidArray);
+ } else {
+ $row[$propertyName] = NULL;
+ }
$objectHasToBeUpdated = TRUE;
}
}
}
-?>
\ No newline at end of file
+?>
* @subpackage Persistence
* @version $Id: LazyLoadingProxy.php 2591 2009-06-09 19:23:47Z k-fish $
*/
-// TODO Implement support for CountableInterface
-class Tx_Extbase_Persistence_LazyLoadingProxy {
+class Tx_Extbase_Persistence_LazyLoadingProxy implements Tx_Extbase_Persistence_LoadingStrategyInterface {
/**
* @var Tx_Extbase_Persistence_QueryFactoryInterface
// it's parent... the result would be weird.
if ($this->parentObject->_getProperty($this->propertyName) instanceof Tx_Extbase_Persistence_LazyLoadingProxy) {
$dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
- $realInstance = $dataMapper->fetchRelatedObjects($this->parentObject, $this->propertyName, $this->fieldValue, $this->columnMap);
+ $objects = $dataMapper->fetchRelatedObjects($this->parentObject, $this->propertyName, $this->fieldValue, $this->columnMap);
+ $realInstance = new Tx_Extbase_Persistence_ObjectStorage();
+ foreach ($objects as $object) {
+ $realInstance->attach($object);
+ }
$this->parentObject->_setProperty($this->propertyName, $realInstance);
$this->parentObject->_memorizeCleanState($this->propertyName);
return $realInstance;
unset($realInstance->$propertyName);
}
}
-?>
\ No newline at end of file
+?>
--- /dev/null
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+ * All rights reserved
+ *
+ * This class is a backport of the corresponding class of FLOW3.
+ * All credits go to the v5 team.
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * A proxy that can replace any object and replaces itself in it's parent on
+ * first access (call, get, set, isset, unset).
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id: LazyLoadingProxy.php 2591 2009-06-09 19:23:47Z k-fish $
+ */
+class Tx_Extbase_Persistence_LazyObjectStorage extends Tx_Extbase_Persistence_ObjectStorage implements Tx_Extbase_Persistence_LoadingStrategyInterface {
+
+ /**
+ * @var Tx_Extbase_Persistence_QueryFactoryInterface
+ */
+ protected $queryFactory;
+
+ /**
+ * The object this property is contained in.
+ *
+ * @var object
+ */
+ private $parentObject;
+
+ /**
+ * The name of the property represented by this proxy.
+ *
+ * @var string
+ */
+ private $propertyName;
+
+ /**
+ * The raw field value.
+ *
+ * @var mixed
+ */
+ private $fieldValue;
+
+ /**
+ *
+ * @var Tx_Extbase_Persistence_Mapper_ColumnMap
+ */
+ private $columnMap;
+
+ /**
+ * Constructs this proxy instance.
+ *
+ * @param object $parentObject The object instance this proxy is part of
+ * @param string $propertyName The name of the proxied property in it's parent
+ * @param mixed $fieldValue The raw field value.
+ * @param Tx_Extbase_Persistence_Mapper_DataMap $dataMap The corresponding Data Map of the property
+ */
+ public function __construct($parentObject, $propertyName, $fieldValue, Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap) {
+ $this->queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
+ $this->parentObject = $parentObject;
+ $this->propertyName = $propertyName;
+ $this->fieldValue = $fieldValue;
+ $this->columnMap = $columnMap;
+ $this->storage = NULL; // TODO
+ }
+
+ /**
+ * This is a function lazy load implementation.
+ *
+ * @return void
+ */
+ protected function initializeStorage() {
+ if (is_null($this->storage)) {
+ $dataMapper = Tx_Extbase_Dispatcher::getPersistenceManager()->getBackend()->getDataMapper();
+ $objects = $dataMapper->fetchRelatedObjects($this->parentObject, $this->propertyName, $this->fieldValue, $this->columnMap);
+ $storage = array();
+ foreach ($objects as $object) {
+ $storage[spl_object_hash($object)] = $object;
+ }
+ $this->storage = $storage;
+ $this->parentObject->_memorizeCleanState($this->propertyName);
+ }
+ if (!is_array($this->storage)) {
+ throw new Tx_Extbase_Persistence_Exception('The storage could not be initialized.', 1252393014); // TODO
+ }
+ }
+
+ /**
+ * Counts the elements in the storage array
+ *
+ * @return void
+ */
+ public function count() {
+ $numberOfElements = NULL;
+ if ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
+ if (isset($parentKeyFieldName)) {
+ $numberOfElements = $this->fieldValue;
+ } else {
+ if (empty($this->fieldValue)) {
+ $numberOfElements = 0;
+ }
+ $numberOfElements = count(explode(',', $this->fieldValue));
+ }
+ } elseif ($this->columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+ $numberOfElements = $this->fieldValue;
+ } else {
+ $this->initializeStorage();
+ $numberOfElements = count($this->storage);
+ }
+ if (is_null($numberOfElements)) {
+ throw new Tx_Extbase_Persistence_Exception('The number of elements could not be determined.', 1252514486);
+ }
+ return $numberOfElements;
+ }
+
+
+}
+?>
\ No newline at end of file
--- /dev/null
+<?php
+/***************************************************************
+ * Copyright notice
+ *
+ * (c) 2009 Jochen Rau <jochen.rau@typoplanet.de>
+ * All rights reserved
+ *
+ * This class is a backport of the corresponding class of FLOW3.
+ * All credits go to the v5 team.
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project is
+ * free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ ***************************************************************/
+
+/**
+ * An interface for the lazy loading strategies.
+ *
+ * @package Extbase
+ * @subpackage Persistence
+ * @version $Id: LazyLoadingProxy.php 2591 2009-06-09 19:23:47Z k-fish $
+ */
+interface Tx_Extbase_Persistence_LoadingStrategyInterface {
+
+}
+?>
\ No newline at end of file
* Constants reflecting the loading strategy
*/
const STRATEGY_EAGER = 'eager';
- const STRATEGY_PROXY = 'proxy';
-
+ const STRATEGY_LAZY_PROXY = 'proxy';
+ const STRATEGY_LAZY_STORAGE = 'storage';
+
/**
* The property name corresponding to the table name
*
public function setLoadingStrategy($loadingStrategy) {
switch ($loadingStrategy) {
- case self::STRATEGY_PROXY;
- // Add more to check for allowed strategies, or-even better-use an interface
+ case self::STRATEGY_LAZY_PROXY;
+ case self::STRATEGY_LAZY_STORAGE;
$this->loadingStrategy = $loadingStrategy;
break;
default:
}
}
-?>
\ No newline at end of file
+?>
}
$columnMap = new Tx_Extbase_Persistence_Mapper_ColumnMap($columnName, $propertyName);
$this->setPropertyType($columnMap, $columnConfiguration);
- // TODO Check support for IRRE
$this->setRelations($columnMap, $columnConfiguration);
$this->addColumnMap($columnMap);
}
return $convertedValue;
}
-}
\ No newline at end of file
+}
*
* @param string $className Name of the class to create a skeleton for
* @return object The object skeleton
-
*/
protected function createEmptyObject($className) {
// Note: The class_implements() function also invokes autoload to assure that the interfaces
* @param int $loadingStrategy The loading strategy; one of Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_*
* @return array|Tx_Extbase_Persistence_ObjectStorage|Tx_Extbase_Persistence_LazyLoadingProxy|another implementation of a loading strategy
*/
- // FIXME There is a recursion problem with post1 -> post2 and post2 -> post1
protected function mapRelatedObjects(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, Tx_Extbase_Persistence_RowInterface $row, Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap) {
$dataMap = $this->getDataMap(get_class($parentObject));
$columnMap = $dataMap->getColumnMap($propertyName);
$fieldValue = $row[$columnMap->getColumnName()];
- if ($columnMap->getLoadingStrategy() === Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_PROXY) {
- // TODO Remove dependency to the loading strategy implementation
+ if ($columnMap->getLoadingStrategy() === Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_LAZY_PROXY) {
$result = t3lib_div::makeInstance('Tx_Extbase_Persistence_LazyLoadingProxy', $parentObject, $propertyName, $fieldValue, $columnMap);
} else {
- $result = $this->fetchRelatedObjects($parentObject, $propertyName, $fieldValue, $columnMap);
+ $queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
+ if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
+ $query = $queryFactory->create($columnMap->getChildClassName());
+ // 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
+ // enableFields and storage page settings.
+ $query->getQuerySettings()->setRespectStoragePage(FALSE);
+ $result = current($query->matching($query->withUid((int)$fieldValue))->execute());
+ } else {
+ if ($columnMap->getLoadingStrategy() === Tx_Extbase_Persistence_Mapper_ColumnMap::STRATEGY_LAZY_STORAGE) {
+ $objectStorage = new Tx_Extbase_Persistence_LazyObjectStorage($parentObject, $propertyName, $fieldValue, $columnMap);
+ } else {
+ $objects = $this->fetchRelatedObjects($parentObject, $propertyName, $fieldValue, $columnMap);
+ $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
+ foreach ($objects as $object) {
+ $objectStorage->attach($object);
+ }
+ }
+ $result = $objectStorage;
+ }
}
-
return $result;
}
* @param string $propertyName The name of the proxied property in it's parent
* @param mixed $fieldValue The raw field value.
* @param Tx_Extbase_Persistence_Mapper_DataMap $dataMap The corresponding Data Map of the property
+ * @return Tx_Extbase_Persistence_ObjectStorage An Object Storage containing the related objects
*/
public function fetchRelatedObjects(Tx_Extbase_DomainObject_AbstractEntity $parentObject, $propertyName, $fieldValue, Tx_Extbase_Persistence_Mapper_ColumnMap $columnMap) {
$queryFactory = t3lib_div::makeInstance('Tx_Extbase_Persistence_QueryFactory');
- if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_ONE) {
- $query = $queryFactory->create($columnMap->getChildClassName());
- // 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
- // enableFields and storage page settings.
- $query->getQuerySettings()->setRespectStoragePage(FALSE);
- $result = current($query->matching($query->withUid((int)$fieldValue))->execute());
- } elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
- $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
+ if ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_MANY) {
$query = $queryFactory->create($columnMap->getChildClassName());
$parentKeyFieldName = $columnMap->getParentKeyFieldName();
if (isset($parentKeyFieldName)) {
$objects = $query->matching($query->equals($columnMap->getParentKeyFieldName(), $parentObject->getUid()))->execute();
} else {
- $uidArray = t3lib_div::intExplode(',', $fieldValue);
- $uids = implode(',', $uidArray);
// FIXME Using statement() is only a preliminary solution
- $objects = $query->statement('SELECT * FROM ' . $columnMap->getChildTableName() . ' WHERE uid IN (' . $uids . ')')->execute();
- }
- foreach ($objects as $object) {
- $objectStorage->attach($object);
+ $objects = $query->statement('SELECT * FROM ' . $columnMap->getChildTableName() . ' WHERE uid IN (' . $fieldValue . ')')->execute();
}
- $result = $objectStorage;
} elseif ($columnMap->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
- $objectStorage = new Tx_Extbase_Persistence_ObjectStorage();
$relationTableName = $columnMap->getRelationTableName();
$left = $this->QOMFactory->selector(NULL, $relationTableName);
$childClassName = $columnMap->getChildClassName();
$query = $queryFactory->create($columnMap->getChildClassName());
$query->setSource($source);
$objects = $query->matching($query->equals($columnMap->getParentKeyFieldName(), $parentObject->getUid()))->execute();
- foreach ($objects as $object) {
- $objectStorage->attach($object);
- }
- $result = $objectStorage;
+ } else {
+ throw new Tx_Extbase_Persistence_Exception('Could not determine type of relation.', 1252502725);
}
-
- return $result;
+ return $objects;
}
/**
public function getDataMap($className) {
if (!is_string($className) || strlen($className) === 0) throw new Tx_Extbase_Persistence_Exception('No class name was given to retrieve the Data Map for.', 1251315965);
if (empty($this->dataMaps[$className])) {
- // FIXME This is a costy for table name aliases -> implement a DataMapBuilder (knowing the aliases defined in $TCA)
- $mapping = array();
+ // FIXME This is too expensive for table name aliases -> implement a DataMapBuilder (knowing the aliases defined in $TCA)
+ $columnMapping = array();
$extbaseSettings = Tx_Extbase_Dispatcher::getExtbaseFrameworkConfiguration();
- if (isset($extbaseSettings['persistence']['classes'][$className]) && !empty($extbaseSettings['persistence']['classes'][$className]['mapping']['tableName'])) {
- $tableName = $extbaseSettings['persistence']['classes'][$className]['mapping']['tableName'];
+ if (is_array($extbaseSettings['persistence']['classes'][$className])) {
+ $persistenceSettings = $extbaseSettings['persistence']['classes'][$className];
+ if (is_string($persistenceSettings['mapping']['tableName']) && strlen($persistenceSettings['mapping']['tableName']) > 0) {
+ $tableName = $persistenceSettings['mapping']['tableName'];
+ }
+ if (is_array($persistenceSettings['mapping']['columns'])) {
+ $columnMapping = $persistenceSettings['mapping']['columns'];
+ }
} else {
foreach (class_parents($className) as $parentClassName) {
- if (isset($extbaseSettings['persistence']['classes'][$parentClassName]) && !empty($extbaseSettings['persistence']['classes'][$parentClassName]['mapping']['tableName'])) {
- $tableName = $extbaseSettings['persistence']['classes'][$parentClassName]['mapping']['tableName'];
- break;
+ $persistenceSettings = $extbaseSettings['persistence']['classes'][$parentClassName];
+ if (is_array($persistenceSettings)) {
+ if (is_string($persistenceSettings['mapping']['tableName']) && strlen($persistenceSettings['mapping']['tableName']) > 0) {
+ $tableName = $persistenceSettings['mapping']['tableName'];
+ }
+ if (is_array($persistenceSettings['mapping']['columns'])) {
+ $columnMapping = $persistenceSettings['mapping']['columns'];
+ }
}
+ break;
}
}
- if (is_array($extbaseSettings['persistence']['classes'][$parentClassName]['mapping']['columns'])) {
- $mapping = $extbaseSettings['persistence']['classes'][$parentClassName]['mapping']['columns'];
- }
- $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap($className, $tableName, $mapping);
+ $dataMap = new Tx_Extbase_Persistence_Mapper_DataMap($className, $tableName, $columnMapping);
$this->dataMaps[$className] = $dataMap;
}
- return $this->dataMaps[$className];
+ return $this->dataMaps[$className];
}
/**
*
* @var array
*/
- private $storage = array();
+ protected $storage = array();
+ /**
+ * This is a template function to be overwritten by a concrete implementation. It enables you to implement
+ * a lazy load implementation.
+ *
+ * @return void
+ */
+ protected function initializeStorage() {
+ }
+
/**
* Resets the array pointer of the storage
*
* @return void
*/
public function rewind() {
+ $this->initializeStorage();
reset($this->storage);
}
* @return void
*/
public function valid() {
+ $this->initializeStorage();
return $this->current() !== FALSE;
}
* @return void
*/
public function key() {
+ $this->initializeStorage();
return key($this->storage);
}
* @return void
*/
public function current() {
+ $this->initializeStorage();
return current($this->storage);
}
* @return void
*/
public function next() {
+ $this->initializeStorage();
next($this->storage);
}
* @return void
*/
public function count() {
+ $this->initializeStorage();
return count($this->storage);
}
*/
public function offsetSet($offset, $value) {
if (!is_object($offset)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter 1 to be object, ' . gettype($offset) . ' given');
+ // TODO Check implementation again
// if (!is_object($obj)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter 2 to be object, ' . gettype($offset) . ' given');
// if (!($offset === $obj)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Parameter 1 and parameter 2 must be a reference to the same object.');
+ $this->initializeStorage();
if (!$this->contains($offset)) {
$this->storage[spl_object_hash($offset)] = $value;
}
*/
public function offsetExists($offset) {
if (!is_object($offset)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an object, ' . gettype($offset) . ' given');
+ $this->initializeStorage();
return isset($this->storage[spl_object_hash($offset)]);
}
*/
public function offsetUnset($offset) {
if (!is_object($offset)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an object, ' . gettype($offset) . ' given');
+ $this->initializeStorage();
unset($this->storage[spl_object_hash($offset)]);
}
*/
public function offsetGet($offset) {
if (!is_object($offset)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an object, ' . gettype($offset) . ' given');
+ $this->initializeStorage();
return isset($this->storage[spl_object_hash($offset)]) ? $this->storage[spl_object_hash($offset)] : NULL;
}
*/
public function contains($object) {
if (!is_object($object)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an object, ' . gettype($object) . ' given');
+ $this->initializeStorage();
return array_key_exists(spl_object_hash($object), $this->storage);
}
*/
public function attach($object, $value = NULL) {
if (!is_object($object)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an object, ' . gettype($object) . ' given');
+ $this->initializeStorage();
if (!$this->contains($object)) {
if ($value === NULL) {
$value = $object;
*/
public function detach($object) {
if (!is_object($object)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an object, ' . gettype($object) . ' given');
+ $this->initializeStorage();
unset($this->storage[spl_object_hash($object)]);
}
*/
public function addAll($objects) {
if (is_array($objects) || ($objects instanceof Tx_Extbase_Persistence_ObjectStorage)) {
+ $this->initializeStorage();
foreach ($objects as $object) {
$this->attach($object);
}
*/
public function removeAll($objects) {
if (!is_array($object)) throw new Tx_Extbase_MVC_Exception_InvalidArgumentType('Expected parameter to be an array, ' . gettype($object) . ' given');
+ $this->initializeStorage();
foreach ($objects as $object) {
$this->detach($object);
}
* @return array The object storage
*/
public function toArray() {
+ $this->initializeStorage();
return $this->storage;
}
}
-?>
\ No newline at end of file
+?>
public function equals($propertyName, $operand, $caseSensitive = TRUE) {
$uniqueVariableName = uniqid($propertyName);
if (is_object($operand) && !($operand instanceof DateTime)) {
- // FIXME This branch of if-then-else is not fully backported and non functional by now
$operand = $this->persistenceManager->getBackend()->getIdentifierByObject($operand);
- $left = $source;
- $columnMap = $this->dataMapper->getDataMap($this->className)->getColumnMap($propertyName);
- $childTableName = $columnMap->getChildTableName();
- $right = $this->QOMFactory->selector($childClassName);
- $joinCondition = $this->QOMFactory->childNodeJoinCondition($childTableName, $parentTableName);
-
- $this->source = $this->QOMFactory->join(
- $left,
- $right,
- Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_JOIN_TYPE_INNER,
- $joinCondition
+ }
+ if ($caseSensitive) {
+ $comparison = $this->QOMFactory->comparison(
+ $this->QOMFactory->propertyValue($propertyName, $this->getSelectorName()),
+ Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_EQUAL_TO,
+ $this->QOMFactory->bindVariable($uniqueVariableName)
);
-
+ } else {
$comparison = $this->QOMFactory->comparison(
- $this->QOMFactory->propertyValue($propertyName, $sourceSelectorName),
+ $this->QOMFactory->lowerCase(
+ $this->QOMFactory->propertyValue($propertyName, $this->getSelectorName())
+ ),
Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_EQUAL_TO,
$this->QOMFactory->bindVariable($uniqueVariableName)
);
-
+ }
+
+ if ($caseSensitive) {
$this->operands[$uniqueVariableName] = $operand;
} else {
- if ($caseSensitive) {
- $comparison = $this->QOMFactory->comparison(
- $this->QOMFactory->propertyValue($propertyName, $this->getSelectorName()),
- Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_EQUAL_TO,
- $this->QOMFactory->bindVariable($uniqueVariableName)
- );
- } else {
- $comparison = $this->QOMFactory->comparison(
- $this->QOMFactory->lowerCase(
- $this->QOMFactory->propertyValue($propertyName, $this->getSelectorName())
- ),
- Tx_Extbase_Persistence_QOM_QueryObjectModelConstantsInterface::JCR_OPERATOR_EQUAL_TO,
- $this->QOMFactory->bindVariable($uniqueVariableName)
- );
- }
-
- if ($caseSensitive) {
- $this->operands[$uniqueVariableName] = $operand;
- } else {
- $this->operands[$uniqueVariableName] = strtolower($operand);
- }
+ $this->operands[$uniqueVariableName] = strtolower($operand);
}
return $comparison;
}
}
} else {
- throw new InvalidArgumentException('transformToObject() accepts only strings and arrays.', 1251814355);
+ throw new InvalidArgumentException('transformToObject() accepts only numeric values and arrays.', 1251814355);
}
return $propertyValue;
$type = ($matches['type'] === 'int') ? 'integer' : $matches['type'];
$elementType = isset($matches['elementType']) ? $matches['elementType'] : NULL;
- if ($elementType !== NULL && !in_array($type, array('array', 'ArrayObject', 'SplObjectStorage'))) {
+ if ($elementType !== NULL && !in_array($type, array('array', 'ArrayObject', 'Tx_Extbase_Persistence_ObjectStorage', 'Tx_Extbase_Persistence_LazyObjectStorage'))) {
throw new Tx_Extbase_Reflection_Exception_InvalidPropertyType('Property of type "' . $type . '" must not have an element type hint (' . $elementType . ').', 1248103053);
}
}
}
-?>
\ No newline at end of file
+?>
$config['labels'] = '';
$config['extRelPath'] = $relPath;
}
-
- if ((strlen($main) > 0) && !isset($GLOBALS['TBE_MODULES'][$main])) {
+
+ if ((strlen($main) > 0) && !array_key_exists($main, $GLOBALS['TBE_MODULES'])) {
$main = $extensionName . self::convertLowerUnderscoreToUpperCamelCase($main);
} else {
$main = (strlen($main) > 0) ? $main : 'web'; // TODO By now, $main must default to 'web'
}
}
-?>
\ No newline at end of file
+?>