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
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
Ok, it is a little bit difficult to full understanding the unsafe validator.
Efficient coding with Yii implies efficient use of the code generator. This article shares the personalised Gii templates that were built starting from the standard templates proposed by AweGen.
One of the common tasks the web application might be required to perform, especially the app using some kind of a CMS, is to save the history of data changes. Your client for sure will want the answer to this simple question - If I mess this up or delete by accident can we bring it back? Well, DB backup is one thing and quick recovery is another - let's talk about latter one.
Suppose we want to set a category to product (or an item in general term), Also suppose categories has sub-categories (multi-level)
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 ?
Suppose you have Products,Categories and each product belongs in many categories
There are cases that you want to validate the file format, size, extension etc but how to do that without submit the form ?
Suppose you have an Application in Yii that manages hotels each one has many customers.
CGridview displays existent rows of the table (using DataProvider)
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).
/*
Get class constants by token.
If you set constants with same prefix, like:
MY_STATUS_1
MY_STATUS_2
MY_STATUS_3
There are cases you want to update a record on CGridview directly
Everyone have seen a multilayer menu in several CMS
This is an incipient implementation of application-driven database with Yii.
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.
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...
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.