Wiki

Articles in category "how-tos"X
Displaying 11-20 of 327 result(s).

How to nest DB transactions without actually nesting them.

Created 2 months ago by le_topHow-tos0 comments – viewed 1,391 times – ( +1 ) – version 1.1
To secure your database from inconsistencies resulting from failing (complex) operations, you (should) use transactions. However, complex methods often rely on other complex methods that themselves build on transactions. This HowTo presents a method to nest or embed transactions without relying on the database's nesting capabilities.

Pjax on ActiveForm and GridView - Yii2

Created 2 months ago by SreenadhHow-tos3 comments – viewed 5,967 times – ( +3 ) – version 2.0
Here is a example on how to use Pjax with GridView (yii\grid\GridView) and ActiveForm (yii\widgets\ActiveForm) widgets in Yii2.

Yii2: Configuring different sessions for backend and frontend in Yii Advanced Application Template

Created 3 months ago by hrnairHow-tos2 comments – viewed 4,047 times – ( +3 ) – version 2.0
This is as an extension of this wiki by Kartik V which shows to make different enableAutoLogin cookies for frontend and backend.

Use CGridview to sort and filter CSqlDataProvider - when used with UNRELATED tables (or complex queries)

Created 3 months ago by Gerhard LiebenbergHow-tos6 comments – viewed 2,937 times – version 1.1
I have two tables called hospitals and departments. I have a junction table between them which holds the departments in each hospital. But sometimes I need a list of "All hospitals with All possible departments" - regardless of whether they are linked in the junction table or not.

Yii 2.0: Write & use a custom Component in Yii2.0 (Advanced Template)

Created 3 months ago by Deepak PradhanHow-tos0 comments – viewed 3,172 times – version 2.0
This is an extension to Yii 2.0: Write & use a custom Component in Yii2.0 for Advanced Template

Yii configuration: Dynamic & User dependent

Created 3 months ago by le_topHow-tos0 comments – viewed 2,101 times – ( +1 ) – version 1.1
It is difficult to perform user dependent theming through a general configuration in 'main.php'. This article proposes a method to do so through a Factory that dynamically generates classes to allow delayed resolution of actual user values. This means that you can refer to values that are stored in the database through the CActiveRecord before Yii is actually loaded. The values will be fetched from the database when actually used for the first time, which is after Yii is loaded. Actually, you can use pretty much any method that relies on Yii with this method.

How to hide /frontend/web in url addresses on apache

Created 4 months ago by raminiousHow-tos10 comments – viewed 29,437 times – ( +11 ) – version 2.0
There is an issue on Yii2 to redirecting / urls to /frontend/web. In other words we need a way to hidden /frontend/web from addresses. We will do this without changing Apache configuration and creating virtual host or setting document root (It's good for share hostings that we have not access to apache.conf)

MongoDB's RBAC support class extending BaseManager

Created 4 months ago by edoardo849How-tos1 comment – viewed 2,743 times – version 2.0
Here's a possible implementation for MongoDb of the RBAC standard. Create a class "MongoDbManager" in common\components and modify your params.php file like this:
tags: mongodb, rbac, yii2

Behaviour for Time Zone and Format conversion for Date, Time, timestamp, and datetime

Created 4 months ago by SmitheshHow-tos0 comments – viewed 3,173 times – ( +2 ) – version 1.1
This Behaviour helps to view time/date/timestamp/datetime from db to local Date / Time / Date Time format and in local Timezone. And save into db in with db timezone and db format. You only need to include this behaviour in models where need this facility.

Check users online, user last activity, user last ip

Created 4 months ago by frazelliHow-tos5 comments – viewed 3,463 times – ( +2 ) – version 1.1
DbHttpSession