Filepath: phork/php/core/CoreDatabaseScaffoldModel.class.php

The CoreDatabaseScaffoldModel class is an extension of the CoreDatabaseModel class that's used to work with data stored in a database. The primary difference is that no data definitions are inherent to the scaffolded class. When instantiated it queries the database to determine the columns in it.

This shouldn't be used in a production environment. It should be used in development when you need a quick and dirty way to work with the database.

Basic Example

//scaffold the foo table
AppLoader::includeClass('php/core/', 'CoreDatabaseScaffoldModel');
$objScaffold = new CoreDatabaseScaffoldModel(array('Table' => 'foo'));

//load all the records from the foo table
if ($objScaffold->load() && $objScaffold->count()) {

    //pass each record off to a pre-defined formatting function
    while ($objRecord = $objScaffold->passthru(array($objFormatter, 'formatRecord'), 'each')) {