PHP Class Neos\ContentRepository\Domain\Service\ContextFactory

Refer to 'ContextFactoryInterface' instead of 'ContextFactory' when injecting this factory into your own class.
Inheritance: implements Neos\ContentRepository\Domain\Service\ContextFactoryInterface
Show file Open project: neos/neos-development-collection Class Usage Examples

Protected Properties

Property Type Description
$contentDimensionRepository Neos\ContentRepository\Domain\Repository\ContentDimensionRepository
$contextImplementation string The context implementation this factory will create
$contextInstances array
$now Neos\Flow\Utility\Now
$securityContext Neos\Flow\Security\Context

Public Methods

Method Description
create ( array $contextProperties = [] ) : Context Create the context from the given properties. If a context with those properties was already created before then the existing one is returned.
getInstances ( ) : array Returns all known instances of Context.
reset ( ) Reset instances (internal)

Protected Methods

Method Description
buildContextInstance ( array $contextProperties ) : Context Creates the actual Context instance.
getAvailableDimensions ( ) : array<\Neos\ContentRepository\Domain\Model\ContentDimension>
getIdentifier ( array $contextProperties ) : string Provides a way to identify a context to prevent duplicate context objects.
getIdentifierSource ( array $contextProperties ) : string This creates the actual identifier and needs to be overridden by builders extending this.
mergeContextPropertiesWithDefaults ( array $contextProperties ) : array Merges the given context properties with sane defaults for the context implementation.
mergeDimensionValues ( array $contextProperties, array &$mergedProperties ) : void
mergeTargetDimensionContextProperties ( array $contextProperties, array &$mergedProperties, array $defaultContextProperties ) : mixed
removeDeprecatedProperties ( array $contextProperties ) : array Removes context properties which have been previously allowed but are not supported anymore and should be silently ignored
validateContextProperties ( array $contextProperties ) : void

Method Details

buildContextInstance() protected method

This needs to be overridden if the Builder is extended.
protected buildContextInstance ( array $contextProperties ) : Context
$contextProperties array
return Context

create() public method

The context properties to give depend on the implementation of the context object, for the Neos\ContentRepository\Domain\Service\Context it should look like this: array( 'workspaceName' => 'live', 'currentDateTime' => new \Neos\Flow\Utility\Now(), 'dimensions' => array(...), 'targetDimensions' => array('language' => 'de', 'persona' => 'Lisa'), 'invisibleContentShown' => FALSE, 'removedContentShown' => FALSE, 'inaccessibleContentShown' => FALSE ) This array also shows the defaults that get used if you don't provide a certain property.
public create ( array $contextProperties = [] ) : Context
$contextProperties array
return Context

getAvailableDimensions() protected method

protected getAvailableDimensions ( ) : array<\Neos\ContentRepository\Domain\Model\ContentDimension>
return array<\Neos\ContentRepository\Domain\Model\ContentDimension>

getIdentifier() protected method

Provides a way to identify a context to prevent duplicate context objects.
protected getIdentifier ( array $contextProperties ) : string
$contextProperties array
return string

getIdentifierSource() protected method

This creates the actual identifier and needs to be overridden by builders extending this.
protected getIdentifierSource ( array $contextProperties ) : string
$contextProperties array
return string

getInstances() public method

Returns all known instances of Context.
public getInstances ( ) : array
return array

mergeContextPropertiesWithDefaults() protected method

Merges the given context properties with sane defaults for the context implementation.
protected mergeContextPropertiesWithDefaults ( array $contextProperties ) : array
$contextProperties array
return array

mergeDimensionValues() protected method

protected mergeDimensionValues ( array $contextProperties, array &$mergedProperties ) : void
$contextProperties array
$mergedProperties array
return void

mergeTargetDimensionContextProperties() protected method

protected mergeTargetDimensionContextProperties ( array $contextProperties, array &$mergedProperties, array $defaultContextProperties ) : mixed
$contextProperties array
$mergedProperties array
$defaultContextProperties array
return mixed

removeDeprecatedProperties() protected method

Removes context properties which have been previously allowed but are not supported anymore and should be silently ignored
protected removeDeprecatedProperties ( array $contextProperties ) : array
$contextProperties array
return array

reset() public method

Reset instances (internal)
public reset ( )

validateContextProperties() protected method

protected validateContextProperties ( array $contextProperties ) : void
$contextProperties array
return void

Property Details

$contentDimensionRepository protected property

protected ContentDimensionRepository,Neos\ContentRepository\Domain\Repository $contentDimensionRepository
return Neos\ContentRepository\Domain\Repository\ContentDimensionRepository

$contextImplementation protected property

The context implementation this factory will create
protected string $contextImplementation
return string

$contextInstances protected property

protected array $contextInstances
return array

$now protected property

protected Now,Neos\Flow\Utility $now
return Neos\Flow\Utility\Now

$securityContext protected property

protected Context,Neos\Flow\Security $securityContext
return Neos\Flow\Security\Context