Re: Problem in DB_DataObject use/setup
| From: | Alan Knowles | Date: | Thu, 11 Sep 2003 00:14:10 +0000 |
| Subject: | Re: Problem in DB_DataObject use/setup | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-7707@lists.php.net to get a copy of this message | ||
Ronald Van Raaphorst wrote:
Hi all, I'm having a faily difficult time at getting started... I'm trying to get a simple DB_Dataobject started, as described in the manual, but I got an error DB Error: not found Now, my test scripts looks like: <?php require_once('Config.php'); require_once('DataObjects/Article.php');try adding DB_DataObject::debugLevel(5); It could be a number of things: a) DB/mysql.php is not in the path or not found.. - remove the @ infront of the include line in DB.php DB::connect() b) you do not have mysql compiled in... c) password/database name is wrong? Regards Alan
$article = new DataObjects_Article; $article->get('29'); // I know this record is in there... (article.id) print_r($article); ?> I have problems with the fact that there are puzzle pieces anywhere, but not an example of the complete puzzle. What do I miss to perform the right setup? What I have done is this: On my site (at the ISP), I have defined a Pear map, which contains: Config.php DataObject.ini DataObject.php DB.php PEAR.php test.php DataObjects (MAP) Article.php (Generated witht the createTables.php) Category.php ( "" ) mydatabase.ini DB (MAP) common.php mysql.php Config.php contains: <?phprequire_once('PEAR.php');$options = &PEAR::getStaticProperty('DB_DataObject','options'); $config = parse_ini_file('DataObject.ini'); $options = $config['DB_DataObject'];?> DataObject.ini contains: [DB_DataObject]database = mysql://IAm:MyPasword@localhost/mydatabaseschema_location = /usr/local/slash/apache/vhosts/www.MySite.com/httpdocs/Pear/DataObjects class_location = /usr/local/slash/apache/vhosts/www.MySite.com/httpdocs/Pear/DataObjects require_prefix = DataObjects/class_prefix = DataObjects_extends_location = extends = generator_class_rewrite = debug = 3 debug_ignore_updates = 0 dont_die = 0 DataObjects\Article.php looks like: <?php /** * Table Definition for article */ require_once 'DataObject.php'; class DataObjects_Article extends DB_DataObject {###START_AUTOCODE /* the code below is auto generated do not remove the above tag */var $__table = 'article'; // table name var $id; // int(8) not_null primary_keyauto_incrementvar $name; // string(80) not_null unique_keymultiple_keyvar $categoryid; // int(6) not_null multiple_key var $articlegroupid; // int(8) not_null multiple_key/* ZE2 compatibility trick*/ function __clone() { return $this;}/* Static get */ function staticGet($k,$v=NULL) { returnDB_DataObject::staticGet('DataObjects_Article',$k,$v); }/* the code above is auto generated do not remove the tag below */ ###END_AUTOCODE} ?> TIA Ronald