Wiki

Articles tagged with "model"X
Displaying 11-20 of 21 result(s).

How to preload dropdowns in CForm

Created about a year ago by transistorTips0 comments – viewed 3,733 times – ( +1 )
So you want to use CForm (form builder), but need to preload dropdowns in a form? It's simpler than it seems. You got your CFormModel, CForm and the actual Form, right? Let's say you have the typical State -> City dependent dropdowns, so you would want to load the from with the State and City selected.

"safe" and "unsafe" Model validators (massive assignments)

Created about a year ago by KonApazHow-tos4 comments – viewed 9,394 times – ( +4 / -6 )
Ok, it is a little bit difficult to full understanding the unsafe validator.

Generate a multi-lever array sub-category for a menu

Created about a year ago by KonApazHow-tos7 comments – viewed 10,034 times – ( +10 ) – version 1.1
Everyone have seen a multilayer menu in several CMS

model rules depended by user roles-permissions

Created about a year ago by KonApazHow-tos0 comments – viewed 5,470 times – ( +3 )
This is a reference about model validators and user roles. In many cases we want model validators to applied only for some privileged users or not

Inline views, write less

Created about a year ago by FirebreakerTips0 comments – viewed 3,826 times – ( +3 )
Sometimes writing views like

Update two models with one view

Created 2 years ago by sensorarioTips11 comments – viewed 30,948 times – ( +10 / -2 ) – version 1.1
Suppose to have two models: Users and Emails. You do not want to store email in a Users model. And User can have 0 or many emails. This is the form generated to create a new user (just username).
tags: database, model, view, form

Managing constants easily

Created 2 years ago by briiC.lvTips4 comments – viewed 10,139 times – ( +4 ) – version 1.1
For time to time i have models with constants (basicly status constants) which i use in diferent places and if these constant changes, i have to change mentions of constant in code elsewhere.

Application-driven database with CDbMigration and an extended CActiveRecord

Created 2 years ago by Tudor IlisoiOthers0 comments – viewed 8,223 times – ( +8 ) – version 1.1
This is an incipient implementation of application-driven database with Yii.
tags: database, model

Single table inheritance

Created 3 years ago by samdarkHow-tos6 comments – viewed 22,678 times – ( +38 ) – 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.

Search method of a model for filters when using dates - unixtimestamp in database

Created 3 years ago by MukkeTips1 comment – viewed 22,067 times – ( +10 ) – version 1.1
I ran into a problem and on irc we worked it out. Since there is a lack on information on filters in genral i thought i'd start sharing all my findings, might be usefull for other people.