Showing 1-6 of 6 items.

Cheat Sheet: Displaying Name instead of Numbers and Displaying Alphanumeric instead of numeric values

Created 13 years ago by skworden skworden, updated 13 years ago by skworden skworden. 4 comments

I keep a reference to some simple but painful task if you forget a common or something. I am new to Yii and this took awhile for me to figure out. Everything I read said do this or do that and not a single one worked for me. However, the following did.

1:n relations sometimes require CDbCriteria.together

Created 14 years ago by fsb fsb, updated 12 years ago by fsb fsb. 5 comments

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.

15 0
12
Viewed: 55 629 times
Version: 1.1
Category: Tips

Relations: BELONGS_TO versus HAS_ONE

Created 15 years ago by Steve Friedl Steve Friedl, updated 13 years ago by Jorgee Jorgee. 9 comments

It's very common to see new Yii users confusing the relations HAS_ONE and BELONGS_TO, and getting it wrong means you won't get proper values back. And though we'll talk about HAS_MANY as well, we're specifically omitting the MANY_MANY relation because it's a whole different animal.

56 0
35
Viewed: 172 603 times
Version: 1.1
Category: FAQs