PHP Class Neos\ContentRepository\Domain\Service\Context

Afficher le fichier Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Свойство Type Description
$contextFactory Neos\ContentRepository\Domain\Service\ContextFactoryInterface
$currentDateTime DateTime
$dimensions array
$firstLevelNodeCache Neos\ContentRepository\Domain\Service\Cache\FirstLevelNodeCache
$inaccessibleContentShown boolean If TRUE, even content elements will be shown which are not accessible by the currently logged in account.
$invisibleContentShown boolean If TRUE, invisible content elements will be shown.
$nodeDataRepository Neos\ContentRepository\Domain\Repository\NodeDataRepository
$nodeFactory Neos\ContentRepository\Domain\Factory\NodeFactory
$removedContentShown boolean If TRUE, removed content elements will be shown, even though they are removed.
$systemLogger Neos\Flow\Log\SystemLoggerInterface
$targetDimensions array
$workspace Neos\ContentRepository\Domain\Model\Workspace
$workspaceName string
$workspaceRepository Neos\ContentRepository\Domain\Repository\WorkspaceRepository

Méthodes publiques

Méthode Description
__construct ( string $workspaceName, DateTimeInterface $currentDateTime, array $dimensions, array $targetDimensions, boolean $invisibleContentShown, boolean $removedContentShown, boolean $inaccessibleContentShown ) Creates a new Context object.
adoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, boolean $recursive = false ) : Neos\ContentRepository\Domain\Model\NodeInterface Adopts a node from a (possibly) different context to this context
getCurrentDateTime ( ) : DateTime Returns the current date and time in form of a \DateTime object.
getDimensions ( ) : array An indexed array of dimensions with ordered list of values for matching nodes by content dimensions
getFirstLevelNodeCache ( ) : FirstLevelNodeCache Not public API!
getNode ( string $path ) : Neos\ContentRepository\Domain\Model\NodeInterface Returns a node specified by the given absolute path.
getNodeByIdentifier ( string $identifier ) : Neos\ContentRepository\Domain\Model\NodeInterface Get a node by identifier and this context
getNodeVariantsByIdentifier ( string $identifier ) : array<\Neos\ContentRepository\Domain\Model\NodeInterface> Get all node variants for the given identifier
getNodesOnPath ( mixed $startingPoint, mixed $endPoint ) : array<\Neos\ContentRepository\Domain\Model\NodeInterface> Finds all nodes lying on the path specified by (and including) the given starting point and end point.
getProperties ( ) : array Returns the properties of this context.
getRootNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface Convenience method returns the root node for this context workspace.
getTargetDimensionValues ( ) : array An indexed array of dimensions with a set of values that should be applied when updating or creating
getTargetDimensions ( ) : array An indexed array of dimensions with a set of values that should be applied when updating or creating
getWorkspace ( boolean $createWorkspaceIfNecessary = true ) : Workspace Returns the current workspace.
getWorkspaceName ( ) : string Returns the name of the workspace.
isInaccessibleContentShown ( ) : boolean Tells if nodes which have access restrictions should be accessible through the Node API and queries even without the necessary roles / rights
isInvisibleContentShown ( ) : boolean Tells if nodes which are usually invisible should be accessible through the Node API and queries
isRemovedContentShown ( ) : boolean Tells if nodes which have their "removed" flag set should be accessible through the Node API and queries
validateWorkspace ( Workspace $workspace ) : void This method is called in order to check if a workspace is accessible.

Méthodes protégées

Méthode Description
emitAfterAdoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context, $recursive )
emitBeforeAdoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context, $recursive )

Method Details

__construct() public méthode

NOTE: This is for internal use only, you should use the ContextFactory for creating Context instances.
See also: ContextFactoryInterface
public __construct ( string $workspaceName, DateTimeInterface $currentDateTime, array $dimensions, array $targetDimensions, boolean $invisibleContentShown, boolean $removedContentShown, boolean $inaccessibleContentShown )
$workspaceName string Name of the current workspace
$currentDateTime DateTimeInterface The current date and time
$dimensions array Array of dimensions with array of ordered values
$targetDimensions array Array of dimensions used when creating / modifying content
$invisibleContentShown boolean If invisible content should be returned in query results
$removedContentShown boolean If removed content should be returned in query results
$inaccessibleContentShown boolean If inaccessible content should be returned in query results

adoptNode() public méthode

Checks if a node variant matching the exact dimensions already exists for this context and return it if found. Otherwise a new node variant for this context is created. In case the node already exists in the context but does not match the target dimensions a new, more specific node is created and returned.
public adoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, boolean $recursive = false ) : Neos\ContentRepository\Domain\Model\NodeInterface
$node Neos\ContentRepository\Domain\Model\NodeInterface The node with a different context. If the context of the given node is the same as this context the operation will have no effect.
$recursive boolean If TRUE also adopt all descendant nodes which are non-aggregate
Résultat Neos\ContentRepository\Domain\Model\NodeInterface A new or existing node that matches this context

emitAfterAdoptNode() protected méthode

protected emitAfterAdoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context, $recursive )
$node Neos\ContentRepository\Domain\Model\NodeInterface
$context Context
$recursive

emitBeforeAdoptNode() protected méthode

protected emitBeforeAdoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context, $recursive )
$node Neos\ContentRepository\Domain\Model\NodeInterface
$context Context
$recursive

getCurrentDateTime() public méthode

If you use this method for getting the current date and time everywhere in your code, it will be possible to simulate a certain time in unit tests or in the actual application (for realizing previews etc).
public getCurrentDateTime ( ) : DateTime
Résultat DateTime The current date and time - or a simulated version of it

getDimensions() public méthode

An indexed array of dimensions with ordered list of values for matching nodes by content dimensions
public getDimensions ( ) : array
Résultat array

getFirstLevelNodeCache() public méthode

Not public API!
public getFirstLevelNodeCache ( ) : FirstLevelNodeCache
Résultat Neos\ContentRepository\Domain\Service\Cache\FirstLevelNodeCache

getNode() public méthode

Returns a node specified by the given absolute path.
public getNode ( string $path ) : Neos\ContentRepository\Domain\Model\NodeInterface
$path string Absolute path specifying the node
Résultat Neos\ContentRepository\Domain\Model\NodeInterface The specified node or NULL if no such node exists

getNodeByIdentifier() public méthode

Get a node by identifier and this context
public getNodeByIdentifier ( string $identifier ) : Neos\ContentRepository\Domain\Model\NodeInterface
$identifier string The identifier of a node
Résultat Neos\ContentRepository\Domain\Model\NodeInterface The node with the given identifier or NULL if no such node exists

getNodeVariantsByIdentifier() public méthode

A variant of a node can have different dimension values and path (for non-aggregate nodes). The resulting node instances might belong to a different context.
public getNodeVariantsByIdentifier ( string $identifier ) : array<\Neos\ContentRepository\Domain\Model\NodeInterface>
$identifier string The identifier of a node
Résultat array<\Neos\ContentRepository\Domain\Model\NodeInterface>

getNodesOnPath() public méthode

Finds all nodes lying on the path specified by (and including) the given starting point and end point.
public getNodesOnPath ( mixed $startingPoint, mixed $endPoint ) : array<\Neos\ContentRepository\Domain\Model\NodeInterface>
$startingPoint mixed Either an absolute path or an actual node specifying the starting point, for example /sites/mysitecom
$endPoint mixed Either an absolute path or an actual node specifying the end point, for example /sites/mysitecom/homepage/subpage
Résultat array<\Neos\ContentRepository\Domain\Model\NodeInterface>

getProperties() public méthode

Returns the properties of this context.
public getProperties ( ) : array
Résultat array

getRootNode() public méthode

Convenience method returns the root node for this context workspace.
public getRootNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface
Résultat Neos\ContentRepository\Domain\Model\NodeInterface

getTargetDimensionValues() public méthode

An indexed array of dimensions with a set of values that should be applied when updating or creating
public getTargetDimensionValues ( ) : array
Résultat array

getTargetDimensions() public méthode

An indexed array of dimensions with a set of values that should be applied when updating or creating
public getTargetDimensions ( ) : array
Résultat array

getWorkspace() public méthode

Returns the current workspace.
public getWorkspace ( boolean $createWorkspaceIfNecessary = true ) : Workspace
$createWorkspaceIfNecessary boolean DEPRECATED: If enabled, creates a workspace with the configured name if it doesn't exist already. This option is DEPRECATED, create workspace explicitly instead.
Résultat Neos\ContentRepository\Domain\Model\Workspace The workspace or NULL

getWorkspaceName() public méthode

Returns the name of the workspace.
public getWorkspaceName ( ) : string
Résultat string

isInaccessibleContentShown() public méthode

Tells if nodes which have access restrictions should be accessible through the Node API and queries even without the necessary roles / rights
public isInaccessibleContentShown ( ) : boolean
Résultat boolean

isInvisibleContentShown() public méthode

Tells if nodes which are usually invisible should be accessible through the Node API and queries
public isInvisibleContentShown ( ) : boolean
Résultat boolean

isRemovedContentShown() public méthode

Tells if nodes which have their "removed" flag set should be accessible through the Node API and queries
public isRemovedContentShown ( ) : boolean
Résultat boolean

validateWorkspace() public méthode

At the time of this writing, it is not possible in Flow to restrict access to Workspace through Entity Privileges because Workspaces are used at a very early stage during routing where the security context is not yet initialized. As a workaround, we use a Method Privilege which protects this validateWorkspace() method and thus prevents unauthorized access to a workspace when calling this context's getWorkspace() method. Since some privilege definitions check the "owner" property of a Workspace, we need a real Workspace object and not just the name - hence this method.
public validateWorkspace ( Workspace $workspace ) : void
$workspace Neos\ContentRepository\Domain\Model\Workspace The workspace to check
Résultat void

Property Details

$contextFactory protected_oe property

protected ContextFactoryInterface,Neos\ContentRepository\Domain\Service $contextFactory
Résultat Neos\ContentRepository\Domain\Service\ContextFactoryInterface

$currentDateTime protected_oe property

protected DateTime $currentDateTime
Résultat DateTime

$dimensions protected_oe property

protected array $dimensions
Résultat array

$firstLevelNodeCache protected_oe property

protected FirstLevelNodeCache,Neos\ContentRepository\Domain\Service\Cache $firstLevelNodeCache
Résultat Neos\ContentRepository\Domain\Service\Cache\FirstLevelNodeCache

$inaccessibleContentShown protected_oe property

If TRUE, even content elements will be shown which are not accessible by the currently logged in account.
protected bool $inaccessibleContentShown
Résultat boolean

$invisibleContentShown protected_oe property

If TRUE, invisible content elements will be shown.
protected bool $invisibleContentShown
Résultat boolean

$nodeDataRepository protected_oe property

protected NodeDataRepository,Neos\ContentRepository\Domain\Repository $nodeDataRepository
Résultat Neos\ContentRepository\Domain\Repository\NodeDataRepository

$nodeFactory protected_oe property

protected NodeFactory,Neos\ContentRepository\Domain\Factory $nodeFactory
Résultat Neos\ContentRepository\Domain\Factory\NodeFactory

$removedContentShown protected_oe property

If TRUE, removed content elements will be shown, even though they are removed.
protected bool $removedContentShown
Résultat boolean

$systemLogger protected_oe property

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
Résultat Neos\Flow\Log\SystemLoggerInterface

$targetDimensions protected_oe property

protected array $targetDimensions
Résultat array

$workspace protected_oe property

protected Workspace,Neos\ContentRepository\Domain\Model $workspace
Résultat Neos\ContentRepository\Domain\Model\Workspace

$workspaceName protected_oe property

protected string $workspaceName
Résultat string

$workspaceRepository protected_oe property

protected WorkspaceRepository,Neos\ContentRepository\Domain\Repository $workspaceRepository
Résultat Neos\ContentRepository\Domain\Repository\WorkspaceRepository