Blame view

app/library/App/Model/User.php 918 Bytes
15479603   Alex Savenko   initialize
1
2
3
  <?php
  
  namespace App\Model;
d497e24d   Alex Savenko   test
4
  use Phalcon\Mvc\Model\Validator\Email as EmailValidator;
15479603   Alex Savenko   initialize
5
6
7
  
  class User extends \App\Mvc\DateTrackingModel
  {
852ac6bc   Alex Savenko   user registration
8
      public $id;
d497e24d   Alex Savenko   test
9
10
      public $name;
      public $pass;
515b7fb5   Alex Savenko   user registration
11
      public $email;
d497e24d   Alex Savenko   test
12
      public $role;
15479603   Alex Savenko   initialize
13
14
15
  
      public function getSource()
      {
9e77eecb   Alex Savenko   user registration
16
          return 'user';
15479603   Alex Savenko   initialize
17
18
19
20
21
      }
  
      public function columnMap()
      {
          return parent::columnMap() + [
852ac6bc   Alex Savenko   user registration
22
              'id' => 'id',
d497e24d   Alex Savenko   test
23
24
              'name' => 'name',
              'pass' => 'pass',
08cdcab6   Alex Savenko   user registration
25
26
              'email' => 'email',
              'role' => 'role'
15479603   Alex Savenko   initialize
27
28
          ];
      }
d497e24d   Alex Savenko   test
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
  
      public function validation()
      {
          $validator = new Validation();
  
          $validator->add(
              'email',
              new EmailValidator(
                  [
                      'model'   => $this,
                      'message' => 'Please enter a correct email address',
                  ]
              )
          );
  
          return $this->validate($validator);
      }
15479603   Alex Savenko   initialize
46
  }