TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode:
TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NodeInterface Tx_Fluid_Core_Parser_SyntaxTree_ObjectAccessorNode

Public Member Functions

 __construct ($objectPath)
 
 getObjectPath ()
 
 evaluate (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode
 evaluateChildNodes (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 getChildNodes ()
 
 addChildNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NodeInterface $childNode)
 

Static Public Member Functions

static getPropertyPath ($subject, $propertyPath, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 

Protected Attributes

 $objectPath
 
- Protected Attributes inherited from TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode
 $childNodes = array()
 

Detailed Description

A node which handles object access. This means it handles structures like {object.accessor.bla}

Definition at line 17 of file ObjectAccessorNode.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::__construct (   $objectPath)

Constructor. Takes an object path as input.

The first part of the object path has to be a variable in the TemplateVariableContainer.

Parameters
string$objectPathAn Object Path, like object1.object2.object3

Definition at line 34 of file ObjectAccessorNode.php.

References TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode\$objectPath.

Member Function Documentation

◆ evaluate()

TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::evaluate ( \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface  $renderingContext)

Evaluate this node and return the correct object.

Handles each part (denoted by .) in $this->objectPath in the following order:

  • call appropriate getter
  • call public property, if exists
  • fail

The first part of the object path has to be a variable in the TemplateVariableContainer.

Parameters
\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface$renderingContext
Returns
object The evaluated object, can be any object type.

Implements TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\NodeInterface.

Definition at line 62 of file ObjectAccessorNode.php.

References TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode\$objectPath.

◆ getObjectPath()

TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::getObjectPath ( )

Internally used for building up cached templates; do not use directly!

Returns
string

Definition at line 44 of file ObjectAccessorNode.php.

References TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode\$objectPath.

◆ getPropertyPath()

static TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ObjectAccessorNode::getPropertyPath (   $subject,
  $propertyPath,
\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface  $renderingContext 
)
static

Gets a property path from a given object or array.

If propertyPath is "bla.blubb", then we first call getProperty($object, 'bla'), and on the resulting object we call getProperty(..., 'blubb').

For arrays the keys are checked likewise.

Parameters
mixed$subjectAn object or array
string$propertyPath
\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface$renderingContext
Returns
mixed Value of the property

Definition at line 79 of file ObjectAccessorNode.php.

References TYPO3\CMS\Extbase\Reflection\ObjectAccess\getPropertyInternal().

Member Data Documentation

◆ $objectPath