Wiki

Articles tagged with "database", sorted by ratingX
Displaying 1-10 of 20 result(s).

Guidelines for good schema design

Created 2 years ago by Steve FriedlTips13 comments – viewed 55,164 times – ( +139 ) – version 1.1
Virtually all Yii applications are built on top of a database, and though Yii is very flexible in how it addresses your DB, some design choices make things more convenient than others.

Single table inheritance

Created 3 years ago by samdarkHow-tos6 comments – viewed 22,104 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.

Multiple-database support in Yii

Created 3 years ago by Steve FriedlHow-tos14 comments – viewed 63,188 times – ( +28 ) – version 1.1
The customary configuration of a Yii application includes just a single database section in the protected/config/main.php file, but it's easy to extend this to support more than one, tying each Model to one of the databases.
tags: Database

Getting nulls from database instead of empty strings

Created 3 years ago by samdarkTips2 comments – viewed 8,843 times – ( +12 ) – version 1.1
To get null from database instead of empty strings you need to set up your DB connection as follows:
tags: database, null

How to store array/widget configuration to the database with config validation rules

Created 2 months ago by Kartik VTutorials0 comments – viewed 1,267 times – ( +26 / -4 ) – version 2.0
You may have scenarios, where you want to store a specific array configuration to the database. A classic example could be saving Yii widget configuration to the database and then retrieving it at runtime, with dynamic parameters set. This wiki discusses one of the approaches to do this. Let's consider you have something like the NavBar configuration below to store in the db:

A simple class to use a different db for a module

Created 3 years ago by tydeas_drTips2 comments – viewed 12,244 times – ( +9 ) – version 1.1
What would you do if you want/need to have a different than the main database connection in an module's models?

Application-driven database with CDbMigration and an extended CActiveRecord

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

Auto set model fields values

Created 2 years ago by vibhaJadwaniTutorials3 comments – viewed 13,053 times – ( +8 ) – version 1.1
This is a tutorial for how to auto set model values without any code.

How to display static pages in Yii with database content?

Created about a year ago by yasenTutorials4 comments – viewed 17,869 times – ( +8 ) – version 1.1
To extend further static pages as shown by Qiang http://www.yiiframework.com/wiki/22/how-to-display-static-pages-in-yii/ here're the steps to take:

Multiple Databases and Multiple Domains

Created 3 years ago by got 2 doodleTutorials2 comments – viewed 29,235 times – ( +14 / -2 ) – version 1.1
Add these lines in /config/main.php
tags: database