for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace App\Traits;
use Doctrine\ORM\Mapping as ORM;
trait HasTimestamps
{
/**
* @ORM\Column(type="datetime")
*/
private $createdAt;
* @ORM\Column(type="datetime", nullable=true)
private $updatedAt;
* @ORM\PrePersist()
public function onPrePersist(): void
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
}
* @ORM\PreUpdate()
public function onPreUpdate(): void