final class Timestamps (View source)

Creation and modification timestamps of a node

  • created: Date and time a node was created in its content stream
  • originalCreated: Date and time a node was created originally (this is equal to created for nodes in the original content stream)
  • lastModified: Date and time a node was last modified in its content stream (NULL = never modified)
  • originalLastModified Date and time a node was last modified in its original content stream

When a node is originally created via one of the following events:

  • {\Neos\ContentRepository\Core\Projection\ContentGraph\RootNodeAggregateWithNodeWasCreated}
  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregateWithNodeWasCreated} the created and originalCreated values are set to the current date and time.

When the creation even is re-applied on a different content stream (i.e. when publishing a node initially) or when a node variant is created via one of the following events:

  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodeSpecializationVariantWasCreated}
  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodeGeneralizationVariantWasCreated}
  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodePeerVariantWasCreated} the created value is set to the current date and time while the originalCreated value is copied over from the already existing node.

The lastModified and originalLastModified values will be NULL upon creation. This allows for checking whether a node has been modified at all.

When a node is being modified via one of the following events:

  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregateNameWasChanged}
  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodePropertiesWereSet}
  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodeReferencesWereSet}
  • {\Neos\ContentRepository\Core\Projection\ContentGraph\NodeAggregateTypeWasChanged} the lastModified is set to the current date and time. the originalLastModified value is also set to the current date and time if the node is modified in the original content stream. Otherwise, it is copied over from the original event

To order nodes by their timestamps, the {\Neos\ContentRepository\Core\Projection\ContentGraph\TimestampField} can be used (Ordering)

Methods

static Timestamps
create(DateTimeImmutable $created, DateTimeImmutable $originalCreated, DateTimeImmutable|null $lastModified, DateTimeImmutable|null $originalLastModified)

No description

with(DateTimeImmutable|null $created = null, DateTimeImmutable|null $originalCreated = null, DateTimeImmutable|null $lastModified = null, DateTimeImmutable|null $originalLastModified = null)

Returns a new copy with the specified new values

Details

static Timestamps create(DateTimeImmutable $created, DateTimeImmutable $originalCreated, DateTimeImmutable|null $lastModified, DateTimeImmutable|null $originalLastModified)

No description

Parameters

DateTimeImmutable $created
DateTimeImmutable $originalCreated
DateTimeImmutable|null $lastModified
DateTimeImmutable|null $originalLastModified

Return Value

Timestamps

Timestamps with(DateTimeImmutable|null $created = null, DateTimeImmutable|null $originalCreated = null, DateTimeImmutable|null $lastModified = null, DateTimeImmutable|null $originalLastModified = null)

Returns a new copy with the specified new values

Note: The signature of this method might be extended in the future, so it should always be used with named arguments

Parameters

DateTimeImmutable|null $created
DateTimeImmutable|null $originalCreated
DateTimeImmutable|null $lastModified
DateTimeImmutable|null $originalLastModified

Return Value

Timestamps

See also

https://www.php.net/manual/en/functions.arguments.php#functions.named-arguments