Questions tagged [yii2]

Yii 2 is the latest version of the Yii framework - a high-performance, component-based PHP framework

Yii Framework

Yii is a generic Web programming framework, meaning that it can be used for developing all kinds of Web applications using PHP. Because of its component-based architecture and sophisticated caching support, it is especially suitable for developing large-scale applications such as portals, forums, content management systems (CMS), e-commerce projects, RESTful Web services, and so on.

Yii 2.0 is the current version of the Yii PHP framework, released on October 12, 2014. The latest version can be downloaded from the Yii website. Guidelines on how to upgrade minor Yii 2.0 version and changelog can be found here.

Yii 2.0 is a complete rewrite of Yii 1.1 based on PHP 5.4 improvements and aims for simplicity, performance and extensibility. The framework adopts namespaces and traits, PSR standards, , and . Yii 2.0 implements the dependency injection container and service locator. It makes the applications built with Yii more customizable and testable.

Official documentation can be found in the Definitive Guide to Yii 2.0. Further important documentation sources:

More information on the current project status can be found in the Yii 2.0 release announcement and the project roadmap.

15456 questions
3
votes
1 answer

Yii2: data-method='post' is sending GET request

I am making changes in existing web page in yii2. I had this section of code: Html::a('Confirm!',[ 'default/apply', 'confirm' => 1, 'id' => $data->id ],['class' => 'btn-primary','data-method' => 'post']) I have moved…
Radek
  • 67
  • 1
  • 9
3
votes
2 answers

Yii2. $(document).ready troubleshooting

AppAsset: public $js = [ 'plugins/jquery/jquery.min.js', 'plugins/jquery/jquery-migrate.min.js', 'app.js', ]; So I'm wiriting in view file: $script = <<< JS jQuery(document).ready(function() { App.init(); }); …
3
votes
2 answers

yii2 gridview filters with beforeValidate() values

I have a yii2 GridView, as generated by gii CRUD. I point my browser to /model/index. I do not include any search values in the GET string. But the GridView filter comes pre-populated with values. Even if I try to delete or replace these…
Ivo Renkema
  • 2,188
  • 1
  • 29
  • 40
3
votes
1 answer

Yii2 cache invalidation

I have this in my frontend/SiteController.php public function actionPage($slug = 'home') { Url::remember(); $val = Yii::$app->cache->getOrSet($slug, function() use ($slug) { $model =…
Marko Mikulić
  • 1,047
  • 2
  • 10
  • 15
3
votes
3 answers

How to search with an array in Yii2 search model

public function actionIndex() { $searchModel = new SubjectSearch(); $searchModel->search()->query->andFilterWhere(['in','subjectID',[1,2,3]]); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return…
Tsz Fung Li
  • 57
  • 1
  • 1
  • 9
3
votes
1 answer

How to set multi select value from array object in yii2 while updating

I have table which have multiple reference to ohter tables like user id name email categories id title user_categories user_id category_id Here a user will have multiple category associated with him/her I am able to save…
Ahmad Asjad
  • 825
  • 1
  • 8
  • 29
3
votes
1 answer

Is it possible to send get request as logged user in Yii2?

I need to get the page source of Yii2 web page, which requires authorization. For example, there are some posts like mysite.pro/post/123, these pages are available only for logged users. I created a view that can show posts in an editor, so I want…
Teo
  • 230
  • 3
  • 14
3
votes
1 answer

jQuery popover buttons (php)

I have a a button to generate presentations. I generate 8 presentation with one click, and then I can edit each one by clicking on its name. There I have another, smaller form. I want to have also some button there, that will let me choose which…
Olga
  • 433
  • 4
  • 18
3
votes
2 answers

Yii2:Passing variable from controller to javascript

I'm using Yii2 framework for my project. I've a loop in my controller, and this is the code detailController.php: public function actionResult() { $connection = \Yii::$app->db; $searchModel = new HeaderSearch(); $dataProvider = new…
Blackjack
  • 1,016
  • 1
  • 20
  • 51
3
votes
4 answers

How to manage password during update user profile in Yii2

I can add user successfully, For Password hashing I am using md5() But when I update user it is giving an error. Here are the model rules: public function rules() { return [ [['firstname', 'lastname', 'username', 'email', 'role',…
user2678776
3
votes
2 answers

Yii2 Unable to verify your data submission in incognito mode

I have separated backend and frontend by using below: Backend Config/main.php $config = [ 'id' => 'app-backend', 'basePath' => dirname(__DIR__), 'controllerNamespace' => 'backend\controllers', 'bootstrap' => ['log'], 'modules' =>…
DS9
  • 2,995
  • 4
  • 52
  • 102
3
votes
2 answers

rate limit in yii2 vs using nginx for rate limiting

what is difference between rate limiting via yii2 versus using nginx for example as reverse proxy and rate limiter ? REF: Yii2 Rate Limiting Api
fortm
  • 4,066
  • 5
  • 49
  • 79
3
votes
2 answers

Yii2 rest api getBodyParams() can't get params from PUT request

How can I get "token" param from PUT request? Controller: public function actionUpdate() { $params = Yii::$app->getRequest()->getBodyParams(); return $params; } Request: curl -X PUT -H "Authorization: Bearer…
Alex Pavlov
  • 571
  • 1
  • 7
  • 24
3
votes
2 answers

Getting data from yii2 hasmany() function

I am working with yii2 to make a basic website. I need to load a users liked videos when they have logged on. In the database the Videos are stored in the video table, Users are stored in the user table, UserVideoJunction is the junction table…
B_Skitter
  • 31
  • 1
  • 3
3
votes
2 answers

web.config for yii2 (.htaccess file provided)

i'm trying to launch yii2 web site on windows server. My .htaccess file: Options +FollowSymLinks IndexIgnore */* RewriteEngine on # if a directory or a file exists, use it directly RewriteCond %{REQUEST_FILENAME} !-f RewriteCond…
Dmitry
  • 123
  • 4
  • 14
1 2 3
99
100