Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 880 Bytes

File metadata and controls

35 lines (26 loc) · 880 Bytes

This keeps track of timestamp of the lifecycle of a model.

using the default mapping

use Rami\EntityKitBundle\Common\Interfaces\TimeStamped\TimeStampedInterface;
use Rami\EntityKitBundle\Entity\Traits\MappedTimeStampedTrait;

class Blog implements TimeStampedInterface 
{
    use MappedTimeStampedTrait;
    ...
}

This creates a created_at and updated_at columns and keep track of these.

Using your custom mapping

use Rami\EntityKitBundle\Common\Interfaces\TimeStamped\TimeStampedInterface;
use Rami\EntityKitBundle\Entity\Traits\MappedTimeStampedTrait;
use Doctrine\ORM\Mapping as ORM;

class Blog implements TimeStampedInterface 
{
    use TimeStampedTrait;
    
    #[ORM\Column()] <-- Your mapping
    protected ?DateTimeImmutable $createdAt = null;
    
    #[ORM\Column()] <-- Your mapping
    protected ?DateTimeImmutable $updatedAt = null;
}