<div>
<select name="social[0][type]">
<option value="ok">Одноклассники</option>
...
<option value="vk">ВК</option>
</select>
<input type="text" name="social[0][value]" />
</div>
...
<div>
<select name="social[1][type]">
<option value="ok">Одноклассники</option>
...
<option value="vk">ВК</option>
</select>
<input type="text" name="social[1][value]" />
</div>
125: if ($work->category && $work->category->type == Category::TYPE_URGENT_WORK) {
126: $this->doSomething();
127: }
125: if ($work->category instanceof Category && $work->category->type == Category::TYPE_URGENT_WORK) {
126: $this->doSomething();
127: }
[
'attribute' => 'id_shop',
'value'=> function ($model) {
switch ($model->id_shop) {
case 2;
return 'Московский';
case 6;
return 'Пушкина';
case 9;
return 'Сибирский';
case 12;
return 'Четаева';
case 16;
return 'Маркса';
}
return null;
}
],
[
'attribute' => 'id_shop',
'value'=> function (MyModel $model) {
return ArrayHelper::getValue(MyModel::getShopList(), $model->shop_id);
}
],
MyModel extends Model {
public static function getShopList(){
return [
2 => 'Московский',
6 => 'Пушкина',
9 => 'Сибирский',
12 => 'Четаева',
16 => 'Маркса',
];
}
}
/*510*/ // urandom is a symlink to random on FreeBSD
/*511*/ $device = PHP_OS === 'FreeBSD' ? '/dev/random' : '/dev/urandom';
/*512*/ // Check random device for special character device protection mode. Use lstat()
/*513*/ // instead of stat() in case an attacker arranges a symlink to a fake device.
/*514*/ $lstat = @lstat($device);
/*515*/ if ($lstat !== false && ($lstat['mode'] & 0170000) === 020000) {
/*516*/ $this->_randomFile = fopen($device, 'rb') ?: null;
if (isset($result) && $result){
$this->registerJs("$('#myModal').hide()");
}
'accessControl' => [
'class' => AccessControl::class,
'rules' => [
[
'allow' => true,
'roles' => ['@'],
'matchCallbak' => function($rule, $action){
return Yii::$app->user->identity->status !== User::STATUS_BLOCKED;
}
]
],
],
SELECT `services`.*, `prices`.`amount` FROM `services`
LEFT JOIN `prices` ON `prices`.`service_id` = `services`.`id` AND `prices`.`user_id` = 100
Services::find()->select(['services.*', 'prices.amount'])->leftJoin('prices', ['AND',
'services.id = prices.amount',
['prices.user_id' => Yii::$app->user->id],
])->asArray()->all();