Commit 856de6bd48e7915b04571bcc6781efc257ac9605
1 parent
3629dfb9
-User's data form ready
Showing
1 changed file
with
18 additions
and
1 deletions
Show diff stats
models/Customer.php
@@ -30,11 +30,24 @@ | @@ -30,11 +30,24 @@ | ||
30 | */ | 30 | */ |
31 | class Customer extends ActiveRecord implements IdentityInterface | 31 | class Customer extends ActiveRecord implements IdentityInterface |
32 | { | 32 | { |
33 | - | ||
34 | const STATUS_ACTIVE = 10; | 33 | const STATUS_ACTIVE = 10; |
35 | const STATUS_DELETED = 0; | 34 | const STATUS_DELETED = 0; |
36 | const GENDER_MALE = 1; | 35 | const GENDER_MALE = 1; |
37 | const GENDER_FEMALE = 2; | 36 | const GENDER_FEMALE = 2; |
37 | + | ||
38 | + public function getBirthDate() | ||
39 | + { | ||
40 | + if (empty($this->birthday)) { | ||
41 | + return ''; | ||
42 | + } else { | ||
43 | + return date('d.m.Y', $this->birthday); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + public function setBirthDate($value) | ||
48 | + { | ||
49 | + $this->birthday = strtotime($value); | ||
50 | + } | ||
38 | 51 | ||
39 | /** | 52 | /** |
40 | * @inheritdoc | 53 | * @inheritdoc |
@@ -68,6 +81,10 @@ | @@ -68,6 +81,10 @@ | ||
68 | 'required', | 81 | 'required', |
69 | ], | 82 | ], |
70 | [ | 83 | [ |
84 | + [ 'birthDate' ], | ||
85 | + 'safe', | ||
86 | + ], | ||
87 | + [ | ||
71 | [ | 88 | [ |
72 | 'status', | 89 | 'status', |
73 | 'gender', | 90 | 'gender', |