We are going to deploy the new yiiframework.com website on March 23, 2018 from 8:00 to 12:00 UTC.
Website and Yii documentation will not be available in this time frame. Check the news for more details.


Articles tagged with "active record"X
Displaying 11-17 of 17 result(s).

Accessing data in a join table with the related models

Created 6 years ago by fsbHow-tos8 comments – viewed 118,393 times – ( +28 / -2 ) – version 1.1
Sometimes the right place to store application data is in a join table. For example, movie viewers either like or don’t like the movies they watched.

Searching and sorting by related model in CGridView

Created 6 years ago by Maciej LiżewskiTutorials86 comments – viewed 205,195 times – ( +126 / -1 ) – version 1.1
Lets say we have two models and relation between them:

1:n relations sometimes require CDbCriteria.together

Created 6 years ago by fsbTips5 comments – viewed 41,122 times – ( +16 / -1 ) – version 1.1
There are situations in which Active Record will generate nonsense queries from what a nieve Yii user might think is reasonable code. One such situation is a CActiveDataProvider using CDbCriteria to get data from parent and 1:n child table with a condition on the child table.

BaseModuleAR class with MultiActiveRecord

Created 6 years ago by dinhtrungTips0 comments – viewed 9,251 times – ( +2 / -1 ) – version 1.1
MultiActiveRecord is an extension that add support for multiple database connection for your application.

Single table inheritance

Created 6 years ago by samdarkHow-tos8 comments – viewed 39,602 times – ( +41 / -1 ) – version 1.1
Relational databases do not support inheritance so if we need to represent it, we have to somehow store meta info while keeping performance by minimizing JOINs. One way to solve this problem is using single table inheritance. All fields for the whole class tree are stored in a single table. Class name is stored in the type field of the same table.

A simple class to use a different db for a module

Created 6 years ago by tydeas_drTips3 comments – viewed 20,143 times – ( +10 / -1 ) – version 1.1
What would you do if you want/need to have a different than the main database connection in an module's models?

Increasing AR performance in connections with Oracle

Created 7 years ago by TrejderHow-tos14 comments – viewed 27,160 times – ( +2 / -1 ) – version 1.1
Please, note. This article is entirely based on a work done by me colleague developer, who hasn't got account on this webpage and also hasn't got time for writing this article. I'm writing it for him. I will try to forward him any comments that may appear, but can't assure if/when he'll be able to answer. I'm far, far less experienced in Oracle therefore I won't probably be able to help myself.