Re: DataObject datasource for DataGrid

From: Date: Tue, 11 Jan 2005 21:55:27 +0000
Subject: Re: DataObject datasource for DataGrid
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-16882@lists.php.net to get a copy of this message
daniel@electroteque.org wrote:
$options = &PEAR::getStaticProperty('MDB2_DataObject','options'); $config = parse_ini_file('DataObjects/config.ini',TRUE); $options = $config['MDB2_DataObject']; require_once 'DataObjects/Users.php'; require_once 'Structures/DataGrid/DataSource/DataObject.php'; $person = new DataObjects_Users(); //$person->getUsers(); $dg =& new Structures_DataGrid(15,$_GET['page'] ? $_GET['page'] : 1,'HTMLTableCustom'); $source =& new Structures_DataGrid_DataSource_DataObject(); $data = Structures_DataGrid_DataSource::create($person,false,'MDB2'); $options2 = array('generate_columns' => true,'fields' => array('username', 'realname')); $source->bind($data,$options2); $dg->bindDataSource($source);
1 : There is no such MDB2_DataObject datasource driver 2 : You never call bind(). This is a _required_ step, either with
    $dg->bind($dataobject) or with $source->bind($dataobject)
I feel like you should either use DB_DataObject, or post a feature request for a MDB2 driver, or write one by yourself (which I greatly recommend ;-) -- Olivier

« previous php.pear.general (#16882) next »