PHP Класс Neos\ContentRepository\Domain\Service\Context

Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$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

Открытые методы

Метод Описание
__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.

Защищенные методы

Метод Описание
emitAfterAdoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context, $recursive )
emitBeforeAdoptNode ( Neos\ContentRepository\Domain\Model\NodeInterface $node, Context $context, $recursive )

Описание методов

__construct() публичный Метод

NOTE: This is for internal use only, you should use the ContextFactory for creating Context instances.
См. также: 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() публичный Метод

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
Результат Neos\ContentRepository\Domain\Model\NodeInterface A new or existing node that matches this context

emitAfterAdoptNode() защищенный Метод

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

emitBeforeAdoptNode() защищенный Метод

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

getCurrentDateTime() публичный Метод

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
Результат DateTime The current date and time - or a simulated version of it

getDimensions() публичный Метод

An indexed array of dimensions with ordered list of values for matching nodes by content dimensions
public getDimensions ( ) : array
Результат array

getFirstLevelNodeCache() публичный Метод

Not public API!
public getFirstLevelNodeCache ( ) : FirstLevelNodeCache
Результат Neos\ContentRepository\Domain\Service\Cache\FirstLevelNodeCache

getNode() публичный Метод

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
Результат Neos\ContentRepository\Domain\Model\NodeInterface The specified node or NULL if no such node exists

getNodeByIdentifier() публичный Метод

Get a node by identifier and this context
public getNodeByIdentifier ( string $identifier ) : Neos\ContentRepository\Domain\Model\NodeInterface
$identifier string The identifier of a node
Результат Neos\ContentRepository\Domain\Model\NodeInterface The node with the given identifier or NULL if no such node exists

getNodeVariantsByIdentifier() публичный Метод

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
Результат array<\Neos\ContentRepository\Domain\Model\NodeInterface>

getNodesOnPath() публичный Метод

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
Результат array<\Neos\ContentRepository\Domain\Model\NodeInterface>

getProperties() публичный Метод

Returns the properties of this context.
public getProperties ( ) : array
Результат array

getRootNode() публичный Метод

Convenience method returns the root node for this context workspace.
public getRootNode ( ) : Neos\ContentRepository\Domain\Model\NodeInterface
Результат Neos\ContentRepository\Domain\Model\NodeInterface

getTargetDimensionValues() публичный Метод

An indexed array of dimensions with a set of values that should be applied when updating or creating
public getTargetDimensionValues ( ) : array
Результат array

getTargetDimensions() публичный Метод

An indexed array of dimensions with a set of values that should be applied when updating or creating
public getTargetDimensions ( ) : array
Результат array

getWorkspace() публичный Метод

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.
Результат Neos\ContentRepository\Domain\Model\Workspace The workspace or NULL

getWorkspaceName() публичный Метод

Returns the name of the workspace.
public getWorkspaceName ( ) : string
Результат string

isInaccessibleContentShown() публичный Метод

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
Результат boolean

isInvisibleContentShown() публичный Метод

Tells if nodes which are usually invisible should be accessible through the Node API and queries
public isInvisibleContentShown ( ) : boolean
Результат boolean

isRemovedContentShown() публичный Метод

Tells if nodes which have their "removed" flag set should be accessible through the Node API and queries
public isRemovedContentShown ( ) : boolean
Результат boolean

validateWorkspace() публичный Метод

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
Результат void

Описание свойств

$contextFactory защищенное свойство

protected ContextFactoryInterface,Neos\ContentRepository\Domain\Service $contextFactory
Результат Neos\ContentRepository\Domain\Service\ContextFactoryInterface

$currentDateTime защищенное свойство

protected DateTime $currentDateTime
Результат DateTime

$dimensions защищенное свойство

protected array $dimensions
Результат array

$firstLevelNodeCache защищенное свойство

protected FirstLevelNodeCache,Neos\ContentRepository\Domain\Service\Cache $firstLevelNodeCache
Результат Neos\ContentRepository\Domain\Service\Cache\FirstLevelNodeCache

$inaccessibleContentShown защищенное свойство

If TRUE, even content elements will be shown which are not accessible by the currently logged in account.
protected bool $inaccessibleContentShown
Результат boolean

$invisibleContentShown защищенное свойство

If TRUE, invisible content elements will be shown.
protected bool $invisibleContentShown
Результат boolean

$nodeDataRepository защищенное свойство

protected NodeDataRepository,Neos\ContentRepository\Domain\Repository $nodeDataRepository
Результат Neos\ContentRepository\Domain\Repository\NodeDataRepository

$nodeFactory защищенное свойство

protected NodeFactory,Neos\ContentRepository\Domain\Factory $nodeFactory
Результат Neos\ContentRepository\Domain\Factory\NodeFactory

$removedContentShown защищенное свойство

If TRUE, removed content elements will be shown, even though they are removed.
protected bool $removedContentShown
Результат boolean

$systemLogger защищенное свойство

protected SystemLoggerInterface,Neos\Flow\Log $systemLogger
Результат Neos\Flow\Log\SystemLoggerInterface

$targetDimensions защищенное свойство

protected array $targetDimensions
Результат array

$workspace защищенное свойство

protected Workspace,Neos\ContentRepository\Domain\Model $workspace
Результат Neos\ContentRepository\Domain\Model\Workspace

$workspaceName защищенное свойство

protected string $workspaceName
Результат string

$workspaceRepository защищенное свойство

protected WorkspaceRepository,Neos\ContentRepository\Domain\Repository $workspaceRepository
Результат Neos\ContentRepository\Domain\Repository\WorkspaceRepository