本文整理汇总了PHP中TYPO3\CMS\Extbase\Reflection\ObjectAccess::getProperty方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectAccess::getProperty方法的具体用法?PHP ObjectAccess::getProperty怎么用?PHP ObjectAccess::getProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Extbase\Reflection\ObjectAccess
的用法示例。
在下文中一共展示了ObjectAccess::getProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createsValidFieldInterfaceComponents
/**
* @test
*/
public function createsValidFieldInterfaceComponents()
{
$instance = $this->buildViewHelperInstance($this->defaultArguments);
$instance->render();
$component = $instance->getComponent(ObjectAccess::getProperty($instance, 'renderingContext', TRUE), ObjectAccess::getProperty($instance, 'arguments', TRUE));
$this->assertInstanceOf('FluidTYPO3\\Flux\\Form\\WizardInterface', $component);
}
示例2: supportsForeignMatchFields
/**
* @test
*/
public function supportsForeignMatchFields()
{
$arguments = array('name' => 'test', 'foreignMatchFields' => array('test' => 'test'));
$instance = $this->buildViewHelperInstance($arguments, array());
$component = $instance->getComponent(ObjectAccess::getProperty($instance, 'renderingContext', TRUE), ObjectAccess::getProperty($instance, 'arguments', TRUE));
$this->assertEquals($arguments['foreignMatchFields'], $component->getForeignMatchFields());
}
示例3: isDirtyObject
/**
* Checks if object was changed or not
*
* @param object $object
* @return bool
*/
public static function isDirtyObject($object)
{
foreach (array_keys($object->_getProperties()) as $propertyName) {
try {
$property = ObjectAccess::getProperty($object, $propertyName);
} catch (PropertyNotAccessibleException $e) {
// if property can not be accessed
continue;
}
/**
* std::Property (string, int, etc..),
* PHP-Objects (DateTime, RecursiveIterator, etc...),
* TYPO3-Objects (user, page, etc...)
*/
if (!$property instanceof ObjectStorage) {
if ($object->_isDirty($propertyName)) {
return true;
}
} else {
/**
* ObjectStorage
*/
if ($property->_isDirty()) {
return true;
}
}
}
return false;
}
示例4: supportsUseOfControllerAndActionSeparator
/**
* @test
*/
public function supportsUseOfControllerAndActionSeparator()
{
$arguments = array('label' => 'Test field', 'controllerExtensionName' => 'Flux', 'pluginName' => 'API', 'controllerName' => 'Flux', 'actions' => array(), 'disableLocalLanguageLabels' => FALSE, 'excludeActions' => array(), 'localLanguageFileRelativePath' => '/Resources/Private/Language/locallang_db.xml', 'prefixOnRequiredArguments' => '*', 'subActions' => array(), 'separator' => ' :: ');
$instance = $this->buildViewHelperInstance($arguments, array(), NULL, $arguments['extensionName'], $arguments['pluginName']);
$instance->initializeArgumentsAndRender();
$component = $instance->getComponent(ObjectAccess::getProperty($instance, 'renderingContext', TRUE), ObjectAccess::getProperty($instance, 'arguments', TRUE));
$this->assertSame($arguments['separator'], $component->getSeparator());
}
示例5: render
/**
* Get a Property from Field by given Marker and Form
*
* @param string $marker Field Marker
* @param Form $form
* @param string $property Field Property
* @return string Property
*/
public function render($marker, Form $form, $property)
{
$field = $this->fieldRepository->findByMarkerAndForm($marker, $form->getUid());
if ($field !== null) {
return ObjectAccess::getProperty($field, $property);
}
return '';
}
开发者ID:VladStawizki,项目名称:ipl-logistik.de,代码行数:16,代码来源:GetFieldPropertyFromMarkerAndFormViewHelper.php
示例6: canLoadSettings
/**
* @test
*/
public function canLoadSettings()
{
$instance = $this->createInstance();
$instance->loadSettings($this->defaultData);
foreach ($this->defaultData as $propertyName => $propertyValue) {
$result = ObjectAccess::getProperty($instance, $propertyName, TRUE);
$this->assertEquals($propertyValue, $result);
}
}
示例7: validateRequiredProperties
/**
* Validates required properties and adds an error for
* each empty property is empty
* Expects an array with property names as keys and
* error codes as values:
* [
* <propertyName> => <errorCode>
* ]
*
* @param $object
* @param array $requiredProperties An array with property names and error codes
* @return void
* @throws \TYPO3\CMS\Extbase\Reflection\Exception\PropertyNotAccessibleException
*/
protected function validateRequiredProperties($object, $requiredProperties)
{
foreach ($requiredProperties as $propertyName => $errorCode) {
$propertyValue = ObjectAccess::getProperty($object, $propertyName);
if ($this->isEmpty($propertyValue)) {
$this->addError($propertyName . ' is required.', $errorCode);
}
}
}
示例8: 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);
}
}
示例9: render
/**
* Solution for {outer.{inner}} call in fluid
*
* @param object|array $obj object or array
* @param string $prop property name
* @return mixed
*/
public function render($obj, $prop)
{
if (is_array($obj) && array_key_exists($prop, $obj)) {
return $obj[$prop];
}
if (is_object($obj)) {
return ObjectAccess::getProperty($obj, GeneralUtility::underscoredToLowerCamelCase($prop));
}
return null;
}
示例10: getCountries
/**
* Build array with countries
*
* @param string $key
* @param string $value
* @param string $sortbyField
* @param string $sorting
* @return array
*/
public function getCountries($key = 'isoCodeA3', $value = 'officialNameLocal', $sortbyField = 'isoCodeA3', $sorting = 'asc')
{
$countries = $this->countryRepository->findAllOrderedBy($sortbyField, $sorting);
$countriesArray = [];
foreach ($countries as $country) {
/** @var $country \SJBR\StaticInfoTables\Domain\Model\Country */
$countriesArray[ObjectAccess::getProperty($country, $key)] = ObjectAccess::getProperty($country, $value);
}
return $countriesArray;
}
示例11: canTidySourceFromArgument
/**
* @test
*/
public function canTidySourceFromArgument()
{
$instance = $this->createInstance();
if (FALSE === ObjectAccess::getProperty($instance, 'hasTidy', TRUE)) {
return;
}
$source = '<foo> <bar>
</bar> </foo>';
$test = $this->executeViewHelper(array('content' => $source));
$this->assertNotSame($source, $test);
}
示例12: render
/**
* Renders the content.
*
* @param string $extensionName Render partial of this extension
* @param string $partial The partial to render
* @param array $arguments Arguments to pass to the partial
* @return string
*/
public function render($extensionName, $partial = null, array $arguments = array())
{
// Overload arguments with own extension local settings (to pass own settings to external partial)
$arguments = $this->loadSettingsIntoArgumentsNonStatic($arguments);
$oldPartialRootPaths = ObjectAccess::getProperty($this->viewHelperVariableContainer->getView(), 'partialRootPaths', true);
$newPartialRootPaths = array(ExtensionManagementUtility::extPath($extensionName) . 'Resources/Private/Partials');
$this->viewHelperVariableContainer->getView()->setPartialRootPaths($newPartialRootPaths);
$content = $this->viewHelperVariableContainer->getView()->renderPartial($partial, null, $arguments);
$this->viewHelperVariableContainer->getView()->setPartialRootPaths($oldPartialRootPaths);
return $content;
}
示例13: updateAction
/**
* action update
*
* @param User $user
* @validate $user In2code\Femanager\Domain\Validator\ServersideValidator
* @validate $user In2code\Femanager\Domain\Validator\CaptchaValidator
* @return void
*/
public function updateAction(\Gigabonus\Gbfemanager\Domain\Model\User $user = null)
{
if ($user !== NULL && $GLOBALS['TSFE']->fe_user->user['uid'] == $user->getUid()) {
$telephonelastchanged = ObjectAccess::getProperty($user, 'txGbfemanagerTelephonelastchanged');
$user->setTxGbfemanagerTelephonelastchanged(time());
parent::updateAction($user);
} else {
// Versuch die uid im FireBug oder Ähnlichem zu manipulieren
exit;
}
}
示例14: render
/**
* Get all fields from form
*
* @param Form $form
* @param string $property
* @param bool $htmlSpecialChars
* @return array
*/
public function render(Form $form, $property = 'title', $htmlSpecialChars = true)
{
$fields = [];
foreach ($form->getPages() as $page) {
foreach ($page->getFields() as $field) {
$fieldProperty = ObjectAccess::getProperty($field, $property);
if ($htmlSpecialChars) {
$fieldProperty = htmlspecialchars($fieldProperty);
}
$fields[] = $fieldProperty;
}
}
return $fields;
}
示例15: createAndTestDummyControllerInstance
/**
* @return AbstractFluxController
*/
protected function createAndTestDummyControllerInstance()
{
$record = Records::$contentRecordWithoutParentAndWithoutChildren;
$record['pi_flexform'] = Xml::SIMPLE_FLEXFORM_SOURCE_DEFAULT_SHEET_ONE_FIELD;
$record['tx_fed_fcefile'] = 'Flux:Default.html';
$frontend = new TypoScriptFrontendController($GLOBALS['TYPO3_CONF_VARS'], 1, 0);
$frontend->cObj = new ContentObjectRenderer();
$frontend->cObj->start($record);
$this->performDummyRegistration();
$controllerClassName = substr(get_class($this), 0, -4);
/** @var AbstractFluxController $instance */
$instance = $this->objectManager->get($controllerClassName);
ObjectAccess::setProperty($instance, 'extensionName', 'Flux', TRUE);
ObjectAccess::getProperty($instance, 'configurationManager', TRUE)->setContentObject($frontend->cObj);
return $instance;
}