BaseUser.class.php 10.1 KB
Newer Older
Игорь's avatar
init    
Игорь committed
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php

/**
 * BaseUser
 * 
 * This class has been auto-generated by the Doctrine ORM Framework
 * 
 * @property string $username
 * @property string $name
 * @property string $email
 * @property string $address
 * @property string $email_check
 * @property string $email_change
 * @property string $email_change_check
 * @property enum $social
 * @property string $phone
 * @property string $phone_check
 * @property string $phone_change
 * @property string $salt
 * @property string $password
 * @property string $password_recovery
 * @property boolean $is_active
 * @property boolean $is_blocked
 * @property boolean $is_super_admin
 * @property timestamp $last_login
 * @property Doctrine_Collection $UserPermissions
 * @property Doctrine_Collection $UserGroup
 * @property Doctrine_Collection $UserGroupUsers
 * @property Doctrine_Collection $UserLog
 * @property Doctrine_Collection $Session
 * @property Doctrine_Collection $Export
 * 
 * @method string              getUsername()           Returns the current record's "username" value
 * @method string              getName()               Returns the current record's "name" value
 * @method string              getEmail()              Returns the current record's "email" value
 * @method string              getAddress()            Returns the current record's "address" value
 * @method string              getEmailCheck()         Returns the current record's "email_check" value
 * @method string              getEmailChange()        Returns the current record's "email_change" value
 * @method string              getEmailChangeCheck()   Returns the current record's "email_change_check" value
 * @method enum                getSocial()             Returns the current record's "social" value
 * @method string              getPhone()              Returns the current record's "phone" value
 * @method string              getPhoneCheck()         Returns the current record's "phone_check" value
 * @method string              getPhoneChange()        Returns the current record's "phone_change" value
 * @method string              getSalt()               Returns the current record's "salt" value
 * @method string              getPassword()           Returns the current record's "password" value
 * @method string              getPasswordRecovery()   Returns the current record's "password_recovery" value
 * @method boolean             getIsActive()           Returns the current record's "is_active" value
 * @method boolean             getIsBlocked()          Returns the current record's "is_blocked" value
 * @method boolean             getIsSuperAdmin()       Returns the current record's "is_super_admin" value
 * @method timestamp           getLastLogin()          Returns the current record's "last_login" value
 * @method Doctrine_Collection getUserPermissions()    Returns the current record's "UserPermissions" collection
 * @method Doctrine_Collection getUserGroup()          Returns the current record's "UserGroup" collection
 * @method Doctrine_Collection getUserGroupUsers()     Returns the current record's "UserGroupUsers" collection
 * @method Doctrine_Collection getUserLog()            Returns the current record's "UserLog" collection
 * @method Doctrine_Collection getSession()            Returns the current record's "Session" collection
 * @method Doctrine_Collection getExport()             Returns the current record's "Export" collection
 * @method User                setUsername()           Sets the current record's "username" value
 * @method User                setName()               Sets the current record's "name" value
 * @method User                setEmail()              Sets the current record's "email" value
 * @method User                setAddress()            Sets the current record's "address" value
 * @method User                setEmailCheck()         Sets the current record's "email_check" value
 * @method User                setEmailChange()        Sets the current record's "email_change" value
 * @method User                setEmailChangeCheck()   Sets the current record's "email_change_check" value
 * @method User                setSocial()             Sets the current record's "social" value
 * @method User                setPhone()              Sets the current record's "phone" value
 * @method User                setPhoneCheck()         Sets the current record's "phone_check" value
 * @method User                setPhoneChange()        Sets the current record's "phone_change" value
 * @method User                setSalt()               Sets the current record's "salt" value
 * @method User                setPassword()           Sets the current record's "password" value
 * @method User                setPasswordRecovery()   Sets the current record's "password_recovery" value
 * @method User                setIsActive()           Sets the current record's "is_active" value
 * @method User                setIsBlocked()          Sets the current record's "is_blocked" value
 * @method User                setIsSuperAdmin()       Sets the current record's "is_super_admin" value
 * @method User                setLastLogin()          Sets the current record's "last_login" value
 * @method User                setUserPermissions()    Sets the current record's "UserPermissions" collection
 * @method User                setUserGroup()          Sets the current record's "UserGroup" collection
 * @method User                setUserGroupUsers()     Sets the current record's "UserGroupUsers" collection
 * @method User                setUserLog()            Sets the current record's "UserLog" collection
 * @method User                setSession()            Sets the current record's "Session" collection
 * @method User                setExport()             Sets the current record's "Export" collection
 * 
 * @package    sf
 * @subpackage model
 * @author     Atma
 * @version    SVN: $Id: Builder.php 7490 2010-03-29 19:53:27Z jwage $
 */
abstract class BaseUser extends sfDoctrineRecord
{
    public function setTableDefinition()
    {
        $this->setTableName('user');
        $this->hasColumn('username', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'unique' => true,
             'length' => 255,
             ));
        $this->hasColumn('name', 'string', 255, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 255,
             ));
        $this->hasColumn('email', 'string', 128, array(
             'type' => 'string',
             'length' => 128,
             ));
        $this->hasColumn('address', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('email_check', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('email_change', 'string', 128, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 128,
             ));
        $this->hasColumn('email_change_check', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('social', 'enum', null, array(
             'type' => 'enum',
             'values' => 
             array(
              0 => 'vk',
              1 => 'fb',
              2 => 'google',
              3 => 'apple',
             ),
             ));
        $this->hasColumn('phone', 'string', 11, array(
             'type' => 'string',
             'length' => 11,
             ));
        $this->hasColumn('phone_check', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('phone_change', 'string', 11, array(
             'type' => 'string',
             'notnull' => true,
             'length' => 11,
             ));
        $this->hasColumn('salt', 'string', 128, array(
             'type' => 'string',
             'length' => 128,
             ));
        $this->hasColumn('password', 'string', 128, array(
             'type' => 'string',
             'length' => 128,
             ));
        $this->hasColumn('password_recovery', 'string', 255, array(
             'type' => 'string',
             'length' => 255,
             ));
        $this->hasColumn('is_active', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             'notnull' => true,
             ));
        $this->hasColumn('is_blocked', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             'notnull' => true,
             ));
        $this->hasColumn('is_super_admin', 'boolean', null, array(
             'type' => 'boolean',
             'default' => false,
             ));
        $this->hasColumn('last_login', 'timestamp', null, array(
             'type' => 'timestamp',
             ));


        $this->index('name_idx', array(
             'fields' => 
             array(
              0 => 'username',
             ),
             'unique' => true,
             ));
    }

    public function setUp()
    {
        parent::setUp();
        $this->hasMany('Permission as UserPermissions', array(
             'refClass' => 'UserPermissions',
             'local' => 'user_id',
             'foreign' => 'permission_id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('UserGroup', array(
             'refClass' => 'UserGroupUsers',
             'local' => 'user_id',
             'foreign' => 'user_group_id',
             'onDelete' => 'CASCADE'));

        $this->hasMany('UserGroupUsers', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('UserLog', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('Session', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $this->hasMany('Export', array(
             'local' => 'id',
             'foreign' => 'user_id'));

        $timestampable0 = new Doctrine_Template_Timestampable();
        $softdelete0 = new Doctrine_Template_SoftDelete();
        $this->actAs($timestampable0);
        $this->actAs($softdelete0);
    }
}