Wiki articles tagged with "model"

Showing 1-18 of 18 items.

Add model validator in Controller

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

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

1 1
3 followers
Viewed: 30 792 times
Version: 1.1
Category: Tips

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

Created 10 years ago by Kostas Apazidis (KonApaz), updated 7 years ago by brianvu.

Ok, it is a little bit difficult to full understanding the unsafe validator.

2 2
7 followers
Viewed: 36 174 times
Version: 1.1
Category: How-tos

Expert's model generation with Gii

Created 9 years ago by le_top, updated 9 years ago by le_top.

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.

1 0
2 followers
Viewed: 16 898 times
Version: 1.1
Category: Tips

Active Record snapshotting (Model data base history)

Created 9 years ago by Bizley, updated 9 years ago by Bizley.

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.

1 0
5 followers
Viewed: 16 481 times
Version: 1.1
Category: Tutorials

Generate CTreeview from database table and update a model

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

Suppose we want to set a category to product (or an item in general term), Also suppose categories has sub-categories (multi-level)

1 0
1 follower
Viewed: 13 593 times
Version: 1.1
Category: How-tos

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

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

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 ?

1 0
1 follower
Viewed: 40 039 times
Version: 1.1
Category: Tutorials

Sort and save order of model-elements drag & drop

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

Suppose you have Products,Categories and each product belongs in many categories

1 0
4 followers
Viewed: 18 954 times
Version: 1.1
Category: Tutorials

ClientValidation for files (modern browsers)

Created 10 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by CeBe.

There are cases that you want to validate the file format, size, extension etc but how to do that without submit the form ?

2 0
6 followers
Viewed: 18 105 times
Version: 1.1
Category: How-tos

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

Created 10 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by CeBe.

Suppose you have an Application in Yii that manages hotels each one has many customers.

2 0
6 followers
Viewed: 41 553 times
Version: 1.1
Category: How-tos

Insert a model record using CGridview

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

CGridview displays existent rows of the table (using DataProvider)

2 0
1 follower
Viewed: 17 478 times
Version: 1.1
Category: How-tos

Update two models with one view

Created 12 years ago by sensorario, updated 11 years ago by SebK.

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).

9 3
13 followers
Viewed: 55 373 times
Version: 1.1
Category: Tips

Managing constants easily

Created 12 years ago by briiC.lv, updated 12 years ago by briiC.lv.

/*

    Get class constants by token.
    If you set constants with same prefix, like:
	MY_STATUS_1
	MY_STATUS_2
	MY_STATUS_3
4 0
7 followers
Viewed: 30 575 times
Version: 1.1
Category: Tips

Update CGridview row separately using ajax request

Created 9 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

There are cases you want to update a record on CGridview directly

5 0
8 followers
Viewed: 25 024 times
Version: 1.1
Category: How-tos

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

Created 10 years ago by Kostas Apazidis (KonApaz), updated 9 years ago by Kostas Apazidis (KonApaz).

Everyone have seen a multilayer menu in several CMS

7 0
8 followers
Viewed: 26 907 times
Version: 1.1
Category: How-tos

Application-driven database with CDbMigration and an extended CActiveRecord

Created 12 years ago by Tudor Ilisoi, updated 12 years ago by Tudor Ilisoi.

This is an incipient implementation of application-driven database with Yii.

8 0
10 followers
Viewed: 16 371 times
Version: 1.1
Category: Others

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

Created 13 years ago by Mukke, updated 12 years ago by jwerner.

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.

10 0
11 followers
Viewed: 37 193 times
Version: 1.1
Category: Tips

Single table inheritance

Created 12 years ago by samdark, updated 12 years ago by samdark.

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...

34 0
35 followers
Viewed: 52 852 times
Version: 1.1
Category: How-tos

Reference: Model rules validation

Created 14 years ago by krillzip, updated 10 years ago by Rodrigo.

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.

99 0
114 followers
Viewed: 884 316 times
Version: 1.1
Category: How-tos