Blame view

app/library/App/Mvc/DateTrackingModel.php 520 Bytes
15479603   Alex Savenko   initialize
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
  <?php
  
  namespace App\Mvc;
  
  class DateTrackingModel extends \Phalcon\Mvc\Model
  {
      public $createdAt;
      public $updatedAt;
  
      public function columnMap()
      {
          return [
              'created_at' => 'createdAt',
              'updated_at' => 'updatedAt',
          ];
      }
  
      public function beforeCreate()
      {
          $this->createdAt = date('Y-m-d H:i:s');
          $this->updatedAt = $this->createdAt;
      }
  
      public function beforeUpdate()
      {
          $this->updatedAt = date('Y-m-d H:i:s');
      }
  }