Re: DB_DataObject

From: Date: Tue, 22 Mar 2005 18:23:45 +0000
Subject: Re: DB_DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-18235@lists.php.net to get a copy of this message
One thing that might help is to use the factory method. It might correct this problem. Meaning, instead of $top_cat = new DataObjects_resource_keyword_cats use $top_cat = DB_DataObject::factory("Resource_keyword_cats"); Trevan Rob Barreca wrote:
Okay, This code get's called multiple times through a Smarty function on a single page. $top_cat = new DataObjects_resource_keyword_cats; $top_cat->short_name = $cfg['domain']; $top_cat->find(true); The first time it works and the second time gives this: |*dataobjects_resource_keyword_cats: __find:* 1| |*dataobjects_resource_keyword_cats: CONNECT:* USING CACHED CONNECTION| |*dataobjects_resource_keyword_cats: CONNECT:* USING CACHED CONNECTION| |*dataobjects_resource_keyword_cats: CONNECT:* USING CACHED CONNECTION| |*dataobjects_resource_keyword_cats: CONNECT:* USING CACHED CONNECTION| |*dataobjects_resource_keyword_cats: QUERY:* SELECT * FROM resource_keyword_cats WHERE resource_keyword_cats.short_name = '' | DB Error: no database selected So I even changed the code to $top_cat = new DataObjects_resource_keyword_cats; $top_cat->database('mysites'); $top_cat->short_name = $cfg['domain']; $top_cat->find(true); But it still says the same thing. I have define('DB_DATAOBJECT_NO_OVERLOAD', 1); set. I was just using $top_cat = &DB_DataObject::staticGet('DataObjects_resource_keyword_cats', 'short_name', $cfg['domain']); and it gave the same result (worked first time, not others).
-- Trevan Richins Computer Science Dep. System Admin

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.pear.general (#18235) next »