Documentation

TimestampableTrait

A trait which can be used to keep track of when changes where made to an entity.

Requires the usage of on the entity using this trait.

Table of Contents

Properties

$createdAt  : DateTime
The date at which the entity was created.
$updatedAt  : DateTime
The date at which the entity was updated.

Methods

getCreatedAt()  : DateTime
getUpdatedAt()  : DateTime
prePersist()  : void
Automatically fill in the `DateTime`s before the initial call to `persist()`.
preUpdate()  : void
Automatically update the `updatedAt` `DateTime` when doing an update to the entity.
setCreatedAt()  : void
setUpdatedAt()  : void

Properties

$createdAt

The date at which the entity was created.

protected DateTime $createdAt
Attributes
#[Column]
$type: 'datetime'

$updatedAt

The date at which the entity was updated.

protected DateTime $updatedAt
Attributes
#[Column]
$type: 'datetime'

Methods

prePersist()

Automatically fill in the `DateTime`s before the initial call to `persist()`.

public prePersist() : void
Attributes
#[PrePersist]

preUpdate()

Automatically update the `updatedAt` `DateTime` when doing an update to the entity.

public preUpdate() : void
Attributes
#[PreUpdate]

setCreatedAt()

private setCreatedAt(DateTime $createdAt) : void
Parameters
$createdAt : DateTime

setUpdatedAt()

private setUpdatedAt(DateTime $updatedAt) : void
Parameters
$updatedAt : DateTime

        
On this page

Search results