Skip to content
Implementation of Yii's CActiveRecord that allows specifying DB table name
PHP
Find file
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
DynamicActiveRecord.php
README.md

README.md

Yii-dynamic-active-record

CActiveRecord implementation that allows specifying DB table name instead of creating a class for each table.

Usage

(assuming table 'user' with columns 'id' and 'name'):

$userModel = DynamicActiveRecord::forTable('user');
//list existing users
foreach ($userModel->findAll() as $user)
    echo $user->id . ': ' . $user->name . '<br>';
//add new user
$userModel->name = 'Pavle Predic';
$userModel->save();
Something went wrong with that request. Please try again.