本文整理汇总了PHP中TYPO3\CMS\Extbase\Reflection\ObjectAccess::isPropertyGettable方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectAccess::isPropertyGettable方法的具体用法?PHP ObjectAccess::isPropertyGettable怎么用?PHP ObjectAccess::isPropertyGettable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Extbase\Reflection\ObjectAccess
的用法示例。
在下文中一共展示了ObjectAccess::isPropertyGettable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPropertyValue
/**
* Load the property value to be used for validation.
*
* In case the object is a doctrine proxy, we need to load the real instance first.
*
* @param object $object
* @param string $propertyName
* @return mixed
*/
protected function getPropertyValue($object, $propertyName)
{
// TODO: add support for lazy loading proxies, if needed
if (ObjectAccess::isPropertyGettable($object, $propertyName)) {
return ObjectAccess::getProperty($object, $propertyName);
} else {
return ObjectAccess::getProperty($object, $propertyName, TRUE);
}
}
示例2: isPropertyGettableWorksOnStdClass
/**
* @test
*/
public function isPropertyGettableWorksOnStdClass()
{
$stdClassObject = new \stdClass();
$stdClassObject->property = 'foo';
$this->assertTrue(\TYPO3\CMS\Extbase\Reflection\ObjectAccess::isPropertyGettable($stdClassObject, 'property'));
$this->assertFalse(\TYPO3\CMS\Extbase\Reflection\ObjectAccess::isPropertyGettable($stdClassObject, 'undefinedProperty'));
}
示例3: determineStoragePageIdForNewRecord
/**
* Determine the storage page ID for a given NEW record
*
* This does the following:
* - If the domain object has an accessible property 'pid' (i.e. through a getPid() method), that is used to store the record.
* - If there is a TypoScript configuration "classes.CLASSNAME.newRecordStoragePid", that is used to store new records.
* - If there is no such TypoScript configuration, it uses the first value of The "storagePid" taken for reading records.
*
* @param \TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object
* @return int the storage Page ID where the object should be stored
*/
protected function determineStoragePageIdForNewRecord(\TYPO3\CMS\Extbase\DomainObject\DomainObjectInterface $object = null)
{
$frameworkConfiguration = $this->configurationManager->getConfiguration(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
if ($object !== null) {
if (\TYPO3\CMS\Extbase\Reflection\ObjectAccess::isPropertyGettable($object, 'pid')) {
$pid = \TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty($object, 'pid');
if (isset($pid)) {
return (int) $pid;
}
}
$className = get_class($object);
if (isset($frameworkConfiguration['persistence']['classes'][$className]) && !empty($frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'])) {
return (int) $frameworkConfiguration['persistence']['classes'][$className]['newRecordStoragePid'];
}
}
$storagePidList = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $frameworkConfiguration['persistence']['storagePid']);
return (int) $storagePidList[0];
}