1 | <?php |
||
26 | trait UserTrait |
||
27 | { |
||
28 | use PasswordTrait, |
||
29 | RegistrationTrait, |
||
30 | IdentityTrait; |
||
31 | |||
32 | /** |
||
33 | * Create new entity model associated with current user. The model to be created |
||
34 | * must be extended from [[BaseBlameableModel]], [[BaseMongoBlameableModel]], |
||
35 | * [[BaseRedisBlameableModel]], or any other classes used [[BlameableTrait]]. |
||
36 | * if $config does not specify `userClass` property, self will be assigned to. |
||
37 | * @param string $className Full qualified class name. |
||
38 | * @param array $config name-value pairs that will be used to initialize |
||
39 | * the object properties. |
||
40 | * @param boolean $loadDefault Determines whether loading default values |
||
41 | * after entity model created. |
||
42 | * Notice! The [[\yii\mongodb\ActiveRecord]] and [[\yii\redis\ActiveRecord]] |
||
43 | * does not support loading default value. If you want to assign properties |
||
44 | * with default values, please define the `default` rule(s) for properties in |
||
45 | * `rules()` method and return them by yourself if you don't specified them in config param. |
||
46 | * @param boolean $skipIfSet whether existing value should be preserved. |
||
47 | * This will only set defaults for attributes that are `null`. |
||
48 | * @return [[$className]] new model created with specified configuration. |
||
|
|||
49 | */ |
||
50 | 3 | public function create($className, $config = [], $loadDefault = true, $skipIfSet = true) |
|
65 | |||
66 | /** |
||
67 | * Find existed, or create new model. |
||
68 | * If model to be found doesn't exist, and $config is null, the parameter |
||
69 | * `$condition` will be regarded as properties of new model. |
||
70 | * If you want to know whether the returned model is new model, please check |
||
71 | * the return value of `getIsNewRecord()` method. |
||
72 | * @param string $className Full qualified class name. |
||
73 | * @param array $condition Search condition, or properties if not found and |
||
74 | * $config is null. |
||
75 | * @param array $config new model's configuration array. If you specify this |
||
76 | * parameter, the $condition will be skipped when created one. |
||
77 | * @return [[$className]] the existed model, or new model created by specified |
||
78 | * condition or configuration. |
||
79 | */ |
||
80 | public function findOneOrCreate($className, $condition = [], $config = null) |
||
95 | |||
96 | /** |
||
97 | * This method is only used for overriding [[removeSelf()]] in [[TimestampTrait]]. |
||
98 | * @see deregister() |
||
99 | * @return boolean |
||
100 | */ |
||
101 | 3 | public function removeSelf() |
|
105 | |||
106 | /** |
||
107 | * Get all rules with current user properties. |
||
108 | * @return array all rules. |
||
109 | */ |
||
110 | 82 | public function rules() |
|
122 | |||
123 | /** |
||
124 | * @var string[] Subsidiary map. |
||
125 | * Array key represents class alias, |
||
126 | * array value represents the full qualified class name corresponds to the alias. |
||
127 | * |
||
128 | * For example: |
||
129 | * ```php |
||
130 | * public $subsidiaryMap = [ |
||
131 | * 'Profile' => 'app\models\user\Profile', |
||
132 | * ]; |
||
133 | * ``` |
||
134 | * or: |
||
135 | * ```php |
||
136 | * public $subsidiaryMap = [ |
||
137 | * 'Profile' => [ |
||
138 | * 'class' => 'app\models\user\Profile', |
||
139 | * 'max' => 1, |
||
140 | * ] |
||
141 | * ]; |
||
142 | * |
||
143 | * If you want to create subsidiary model and the class is not found, the array elements will be taken. |
||
144 | * @see normalizeSubsidiaryClass |
||
145 | */ |
||
146 | public $subsidiaryMap = []; |
||
147 | |||
148 | /** |
||
149 | * |
||
150 | * @param string $class |
||
151 | * @return integer|null |
||
152 | */ |
||
153 | public function getSubsidiaryInstanceMax($class) |
||
160 | |||
161 | /** |
||
162 | * |
||
163 | * @param type $class |
||
164 | * @param type $config |
||
165 | * @return type |
||
166 | * @todo 区分字符串和类的实例两种情况。 |
||
167 | */ |
||
168 | public function createSubsidiary($class, $config = []) |
||
187 | |||
188 | /** |
||
189 | * |
||
190 | * @param string $name |
||
191 | * @param array $params |
||
192 | * @return type |
||
193 | */ |
||
194 | public function __call($name, $params) |
||
203 | } |
||
204 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.