Add TimestampableTypedEntity.php trait

pull/3844/head
Julio Montoya 4 years ago
parent 4375c81d4d
commit 7a28b0c2f5
  1. 65
      src/CoreBundle/Traits/TimestampableTypedEntity.php

@ -0,0 +1,65 @@
<?php
namespace Chamilo\CoreBundle\Traits;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
trait TimestampableTypedEntity
{
/**
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
protected \DateTime $createdAt;
/**
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
protected \DateTime $updatedAt;
/**
* Sets createdAt.
*
* @return $this
*/
public function setCreatedAt(\DateTime $createdAt)
{
$this->createdAt = $createdAt;
return $this;
}
/**
* Returns createdAt.
*
* @return \DateTime
*/
public function getCreatedAt()
{
return $this->createdAt;
}
/**
* Sets updatedAt.
*
* @return $this
*/
public function setUpdatedAt(\DateTime $updatedAt)
{
$this->updatedAt = $updatedAt;
return $this;
}
/**
* Returns updatedAt.
*
* @return \DateTime
*/
public function getUpdatedAt()
{
return $this->updatedAt;
}
}
Loading…
Cancel
Save