diff --git a/Behavior/ControllerTrait.php b/Behavior/ControllerTrait.php index deb9866..ce0d178 100644 --- a/Behavior/ControllerTrait.php +++ b/Behavior/ControllerTrait.php @@ -27,7 +27,7 @@ trait ControllerTrait * @param Exception $previous * @return NotFoundHttpException */ - public abstract function createNotFoundException($message = 'Not Found', Exception $previous = NULL); + public abstract function createNotFoundException($message = 'Not Found', Exception $previous = null); /** * Abstract generate url method. Should return a url string diff --git a/Entity/Behaviors/Timestampable.php b/Entity/Behaviors/Timestampable.php new file mode 100644 index 0000000..a497c70 --- /dev/null +++ b/Entity/Behaviors/Timestampable.php @@ -0,0 +1,57 @@ +createdAt = new DateTime(); + return $this; + } + + /** + * @return DateTime + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * @ORM\PrePersist() + * @ORM\PreUpdate() + * @return $this + */ + public function setUpdatedAt() + { + $this->updatedAt = new DateTime(); + return $this; + } + + /** + * @return DateTime + */ + public function getUpdatedAt() + { + return $this->updatedAt; + } +} \ No newline at end of file