Completed
Push — erdiko2 ( 719271...84f584 )
by John
05:49
created

User   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 131
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 16
lcom 0
cbo 0
dl 0
loc 131
rs 10
c 0
b 0
f 0

16 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A setId() 0 4 1
A getEmail() 0 4 1
A setEmail() 0 4 1
A getPassword() 0 4 1
A setPassword() 0 4 1
A getRole() 0 4 1
A setRole() 0 4 1
A getName() 0 4 1
A setName() 0 4 1
A getCreatedAt() 0 4 1
A setCreatedAt() 0 4 1
A getUpdatedAt() 0 4 1
A setUpdatedAt() 0 4 1
A doStuffOnPrePersist() 0 4 1
A doStuffOnPreMerge() 0 4 1
1
<?php
2
namespace app\entities;
3
4
/**
5
 * @Entity @Table(name="users")
6
 */
7
class User
8
{
9
    /**
10
     * @Id @GeneratedValue @Column(type="integer")
11
     * @var integer
12
     */
13
    protected $id;
14
15
    /**
16
     * @Column(type="string")
17
     * @var string
18
     */
19
    protected $email;
20
21
    /**
22
     * @Column(type="string")
23
     * @var string
24
     */
25
    protected $password;
26
27
    /**
28
     * @Column(type="string")
29
     * @var string
30
     */
31
    protected $role;
32
33
    /**
34
     * @Column(type="string")
35
     * @var string
36
     */
37
    protected $name;
38
39
    /**
40
     * @Column(type="string")
41
     * @var string
42
     */
43
    protected $created_at;
44
45
    /**
46
     * @Column(type="string")
47
     * @var string
48
     */
49
    protected $updated_at;
50
51
    public function getId()
52
    {
53
        return $this->id;
54
    }
55
56
    public function setId($id)
57
    {
58
        $this->id = $id;
59
    }
60
61
    public function getEmail()
62
    {
63
        return $this->email;
64
    }
65
66
    public function setEmail($email)
67
    {
68
        $this->email = $email;
69
    }
70
71
    public function getPassword()
72
    {
73
        return $this->password;
74
    }
75
76
    // @todo add security hashing here
77
    public function setPassword($password)
78
    {
79
        $this->password = $password;
80
    }
81
82
    public function getRole()
83
    {
84
        return $this->role;
85
    }
86
87
    public function setRole($role)
88
    {
89
        $this->role = $role;
90
    }
91
92
    public function getName()
93
    {
94
        return $this->name;
95
    }
96
97
    public function setName($name)
98
    {
99
        $this->name = $name;
100
    }
101
102
    public function getCreatedAt()
103
    { 
104
      return $this->created_at;
105
    }
106
    
107
    public function setCreatedAt($created)
108
    {
109
      $this->created_at = $created;
110
    }
111
112
    public function getUpdatedAt()
113
    { 
114
      return $this->updated_at;
115
    }
116
    
117
    public function setUpdatedAt($updated)
118
    {
119
      $this->updated_at = $updated;
120
    }
121
122
    /** 
123
     *  @ORM\PrePersist 
124
     */
125
    public function doStuffOnPrePersist()
126
    {
127
        $this->created = date('Y-m-d H:i:s');
0 ignored issues
show
Bug introduced by
The property created does not seem to exist. Did you mean created_at?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
128
    }
129
130
    /** 
131
     *  @ORM\PreMerge
132
     */
133
    public function doStuffOnPreMerge()
134
    {
135
        $this->updated = date('Y-m-d H:i:s');
0 ignored issues
show
Bug introduced by
The property updated does not seem to exist. Did you mean updated_at?

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
136
    }
137
}
138