'controllerNamespace' => 'console\controllers',
'controllerNamespace' => 'frontend\controllers',
(new yii\web\Application($config))->run();
$application = new yii\console\Application($config);
$exitCode = $application->run();
exit($exitCode);
id, name, title, description,...
id, name, position, in_filter
product_id, features_id, value
+------------------------------------------------------------+
| product_id | feature_id | value |
+------------------------------------------------------------+
| 1 | 1 | Рефрижератор |
+------------------------------------------------------------+
| 1 | 1 | Рефрижератор+изотерм |
+------------------------------------------------------------+
product_id
по полю features_id
, и по полученному списку айдишников выводить уже данные из таблицы продуктов products $user = User::findOne($userId);
$model = new UserEditForm();
class User extends ActiveRecord
{
// тут и правила проверки и соединение с таблицей и атрибуты и всё-всё.
}
public function actionCreate() {
$model = new UserEditForm();
if($model->load($user) && $model->save()){
// redirect при успешном сохранении модели
}
return $this->renderAjax('_form-edit', [
'model' => $model,
]);
}
public function actionUpdate($id) {
$userId = (int)Yii::$app->request->get('id');
$user = User::findOne($userId);
if($model->load($user) && $model->save()){
}
return $this->renderAjax('_form-edit', [
'model' => $model,
]);
}
public function actionIndex()
{
$query = Article::find()->where(['status' => 1]);
$countQuery = clone $query;
$pages = new Pagination(['totalCount' => $countQuery->count()]);
$models = $query->offset($pages->offset)
->limit($pages->limit)
->all();
return $this->render('index', [
'models' => $models,
'pages' => $pages,
]);
}
foreach ($models as $model) {
// display $model here
}
// display pagination
echo LinkPager::widget([
'pagination' => $pages,
]);
// Action 1
$session = Yii::$app->session;
if($session->isActive){
$session->set('TEST', 123);
}
// Action 2
$session = Yii::$app->session;
echo $session->get('TEST');
а от соц.сетей мы можем не получить того же email
if (!$this->validate()) {
return null;
}
public function signup()
{
if($this->validate()){
$user = new Users();
$user->email = $this->email;
$user->setPassword($this->password);
$user->generateAuthKey();
if($user->save()){
// после успешного сохранения в базу отправляете письмо или ещё что-то делаете
}
return $user;
}
return null;
}
{summary}\n{items}\n<div class="wrap-block">{pager}</div>
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=localhost;dbname=back_import',
...
'enableSchemaCache' => false
$this->db->schema->refreshTableSchema('table_name')