Wiki

Articles tagged with "model", sorted by commentsX
Displaying 1-10 of 23 result(s).

Update two models with one view

Created 2 years ago by sensorarioTips11 comments – viewed 32,377 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

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

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

Reference: Model rules validation

Created 4 years ago by krillzipHow-tos7 comments – viewed 525,772 times – ( +121 ) – version 1.1
This is a reference to be used for Model rule validation and is compiled from the Yii documentation and code. The purpose is to have all the information gathered in one place instead of scattered. This reference is not an intro. See The Definitive Guide to Yii, Declaring Validation Rules for a tutorial.

Single table inheritance

Created 3 years ago by samdarkHow-tos7 comments – viewed 23,996 times – ( +39 ) – 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.

Update CGridview row separately using ajax request

Created 7 months ago by KonApazHow-tos6 comments – viewed 5,954 times – ( +5 ) – version 1.1
There are cases you want to update a record on CGridview directly

Take more control of CGridview and model searching (related model or another controller)

Created 11 months ago by KonApazHow-tos5 comments – viewed 18,059 times – ( +5 ) – version 1.1
Suppose you have an Application in Yii that manages hotels each one has many customers.

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

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

Managing constants easily

Created 2 years ago by briiC.lvTips4 comments – viewed 10,831 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.

Save or Update Multiple related model values in one Tabular input form

Created 6 months ago by KonApazTutorials4 comments – viewed 4,956 times – ( +1 / -6 ) – version 1.1
In this wiki I will show you how to save/update a model with many related model For example: How to set a product to multiple categories only in one post form ?

Add model validator in Controller

Created about a month ago by KonApazTips4 comments – viewed 1,627 times – ( +1 / -1 ) – version 1.1
There are cases that model validators should be depended by controller/action and you couldn't manipulate on the model class or using scenarios in easy way