Re: cvs: pear /DB_DataObject_FormBuilder/examples config_inc.php dataObject.ini index.php

From: Date: Tue, 16 Sep 2003 01:10:20 +0000
Subject: Re: cvs: pear /DB_DataObject_FormBuilder/examples config_inc.php dataObject.ini index.php
References: 1  Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-12765@lists.php.net to get a copy of this message
// Which class to use? if (isset($_GET['class'])) {
    $class = $_GET['class'];
} else {
    $class = 'Product';
} // include that class include_once('classes/'.$class.'.php'); // make the object $obj = new $class;
it may be better to replace this with $obj = DB_DataObject::factory($class); It's not documented yet.. - but I think it should become the prefered way to create dataobjects... (as it includes and instantates them..)
// Maybe an existing record was chosen? If yes, fetch it before making the form! // (If you don't, a new one will be created on form submit) if (isset($_GET['id']) && is_numeric($_GET['id'])) {
    $obj->get($_GET['id']);
}
$obj->setFrom($_GET); if (!$obj->find()) { // nothing found.. }
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

« previous php.pear.cvs (#12765) next »