Task #48964 » ObjectAccess.patch
Classes/Reflection/ObjectAccess.php | ||
---|---|---|
*
|
||
* This copyright notice MUST APPEAR in all copies of the script!
|
||
***************************************************************/
|
||
use TYPO3\CMS\Extbase\Utility\DebuggerUtility;
|
||
/**
|
||
* Provides methods to call appropriate getter/setter on an object given the
|
||
* property name. It does this following these rules:
|
||
... | ... | |
throw new \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException('The property "' . $propertyName . '" on the subject does not exist.', 1302855001);
|
||
}
|
||
}
|
||
if (
|
||
$subject instanceof \ArrayAccess
|
||
&& !($subject instanceof \SplObjectStorage || $subject instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage)
|
||
&& isset($subject[$propertyName])
|
||
) {
|
||
if ($subject instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage || $subject instanceof \SplObjectStorage) {
|
||
$storageAsArray = $subject->toArray();
|
||
if(isset($storageAsArray[$propertyName])) {
|
||
return $storageAsArray[$propertyName];
|
||
}
|
||
} else if ($subject instanceof \ArrayAccess && isset($subject[$propertyName])) {
|
||
return $subject[$propertyName];
|
||
}
|
||
$getterMethodName = 'get' . ucfirst($propertyName);
|
||
... | ... | |
$propertyExists !== TRUE
|
||
&& ($subject instanceof \SplObjectStorage || $subject instanceof \TYPO3\CMS\Extbase\Persistence\ObjectStorage)
|
||
) {
|
||
$subject = NULL;
|
||
$subject = $propertyValue;
|
||
} elseif (
|
||
$propertyExists !== TRUE
|
||
&& (is_array($subject) || $subject instanceof \ArrayAccess)
|