Различия
Показаны различия между двумя версиями страницы.
| Предыдущая версия справа и слева Предыдущая версия Следующая версия | Предыдущая версия | ||
| yii2:docs [2017/03/19 15:33] – [Behaviors/Date] mirocow | yii2:docs [2019/04/18 13:17] (текущий) – [Active Record] mirocow | ||
|---|---|---|---|
| Строка 375: | Строка 375: | ||
| public function getCreator() | public function getCreator() | ||
| { | { | ||
| - | return $this-> | + | return $this-> |
| } | } | ||
| public function getComments() | public function getComments() | ||
| { | { | ||
| - | return $this-> | + | return $this-> |
| } | } | ||
| public function getTrustComments($isTrust = true) | public function getTrustComments($isTrust = true) | ||
| { | { | ||
| - | return $this-> | + | return $this-> |
| - | -> | + | -> |
| ': | ': | ||
| - | | + | |
| -> | -> | ||
| } | } | ||
| Строка 416: | Строка 416: | ||
| // looking for a post | // looking for a post | ||
| $post = $query | $post = $query | ||
| - | | + | |
| | | ||
| // or easier: " | // or easier: " | ||
| - | $post = Post::find(array(' | + | $post = Post::find([' |
| // having transmitted to the factory method not a massive, but a number equivalent to the primary key search | // having transmitted to the factory method not a massive, but a number equivalent to the primary key search | ||
| $post = Post:: | $post = Post:: | ||
| - | | + | |
| | | ||
| Строка 432: | Строка 432: | ||
| // the result as an array | // the result as an array | ||
| $posts = $query-> | $posts = $query-> | ||
| + | </ | ||
| + | |||
| + | <code php> | ||
| + | User:: | ||
| + | User:: | ||
| </ | </ | ||
| Строка 535: | Строка 540: | ||
| { | { | ||
| return [ | return [ | ||
| - | [' | + | |
| - | ' | + | |
| - | // specifies in which scenario(s) this rule is active. | + | ' |
| - | // if not given, it means it is active in all scenarios | + | // specifies in which scenario(s) this rule is active. |
| - | ' | + | // if not given, it means it is active in all scenarios |
| - | // the following name-value pairs will be used | + | ' |
| - | // to initialize the validator properties | + | // the following name-value pairs will be used |
| - | ' | + | // to initialize the validator properties |
| - | ' | + | ' |
| - | // ... | + | ' |
| + | // ... | ||
| + | | ||
| + | [ | ||
| + | [' | ||
| + | ' | ||
| + | | ||
| + | // if not given, it means it is active in all scenarios | ||
| + | ' | ||
| + | // the following name-value pairs will be used | ||
| + | // to initialize the validator properties | ||
| + | ' | ||
| + | ' | ||
| + | // ... | ||
| + | ], | ||
| ]; | ]; | ||
| } | } | ||
| Строка 927: | Строка 946: | ||
| <code php> | <code php> | ||
| - | | + | public function behaviors() |
| - | { | + | { |
| - | return array( | + | return array( |
| - | ' | + | ' |
| - | ' | + | ' |
| - | ' | + | ' |
| - | array(' | + | array(' |
| - | array(' | + | array(' |
| - | ), | + | ), |
| - | ), | + | ), |
| - | ); | + | ); |
| - | } | + | } |
| </ | </ | ||
| Строка 1014: | Строка 1033: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ==== Params / Параметры ==== | ||
| + | |||
| + | <code php> | ||
| + | <?php | ||
| + | |||
| + | namespace console\controllers; | ||
| + | |||
| + | use yii\console\Controller; | ||
| + | |||
| + | class QueueController extends Controller | ||
| + | { | ||
| + | public $pid_file = ''; | ||
| + | |||
| + | public function __get($name) | ||
| + | { | ||
| + | $name = str_replace(' | ||
| + | |||
| + | return $this-> | ||
| + | } | ||
| + | |||
| + | public function __set($name, | ||
| + | { | ||
| + | $name = str_replace(' | ||
| + | |||
| + | $this-> | ||
| + | } | ||
| + | |||
| + | |||
| + | public function options($actionID) | ||
| + | { | ||
| + | return [' | ||
| + | } | ||
| + | |||
| + | public function actionRun() | ||
| + | { | ||
| + | |||
| + | } | ||
| + | } | ||
| + | </ | ||
| + | |||
| ===== User ===== | ===== User ===== | ||