It is convenient to use the same identification attribute, say info
, in all of the active records of your application. It should be a virtual read-only attribute defined by a getter method, its label being the model name.
It is convenient to use the same identification attribute, say info
, in all of the active records of your application. It should be a virtual read-only attribute defined by a getter method, its label being the model name.
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
In yii2 we can create form without create FormModel. Here we go
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.
The yii2-field-range extension enables you to easily setup ActiveField range fields with Bootstrap styling. You basically can setup two attributes joined together like a single field with combined validation error block.
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.
Sometimes writing views like
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
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.