Re: ->insert not working with DB_DataObject

From: Date: Tue, 27 Apr 2004 05:23:52 +0000
Subject: Re: ->insert not working with DB_DataObject
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12149@lists.php.net to get a copy of this message
can you file that as a bug (as in dependency issue.), - it may be worth doing a php side implementation of is_a(), there is talk about doing a general package for this on pear-dev. Try the latest version and add this file: PEAR/CompactFunctions/is_a.php function is_a($object,$string) { if (get_class($object) == strtolower($string)) { return true; } if (is_subclass_of($object,$string)) { return true; } return false; } then try adding if(!function_exists('is_a')) { require_once 'PEAR/CompactFunctions/is_a.php'; } Regards alan David Cannings wrote:
I've had to downgrade from the latest DB_DataObject to version 1.4 as the latest one requires PHP4.2 and the server I've just uploaded a site to only has 4.1. Note that the dependencies for the latest version are listed as PHP4.1 but the code uses is_a(), this is slightly misleading. I've had to change quite a large portion of the code, for example rewriting ->get($id) to ->get("id", $id) as it appears the older version doesn't use autonumber fields by default. However, my ->insert() and ->update fields don't work any more. The code I have is: $category = new ShopCategory(); $category->name = "FOO"; $category->description = "BAR"; $category->insert(); Using if I can test that $category->insert() is actually returning FALSE but I am unsure how to get any more information from PEAR. Does anybody have any idea why the code doesn't work? Looking back at tutorials and the source for DataObject.php it seems that it should still work with this slightly older version. David
-- Can you help out? Need Consulting Services or Know of a Job? http://www.akbkhome.com

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