Re: Re: FormBuilder and QuickForm_Controller

From: Date: Tue, 08 Mar 2005 21:25:12 +0000
Subject: Re: Re: FormBuilder and QuickForm_Controller
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17930@lists.php.net to get a copy of this message
On Tue, 8 Mar 2005 19:47:02 +0000, Edward Grace <ej.grace@imperial.ac.uk> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > > Hey, great timing. I *just* released a new version of FormBuilder with > > the linkNewValue option, which adds a "--New Value--" option to the > > That's spooky.. I was re-reading the docs and I saw that option. I was > cursing myself for being dim and not seeing it sooner. That's a relief, I > thought my mind was going. > > > Check it out and let me know: 1) if it works for you > > Bit of a show stopper I'm afraid.. > > I get a stream of errors (one per select Item?) > > Undefined property: in /usr/share/pear/DB/DataObject/FormBuilder.php on line > 1694 > > Which is in the following chunk > > // FINALLY, let's see if there are any results > if ($opts->find() > 0) { > while ($opts->fetch()) { > $list[$opts->$pk] = $this->getDataObjectString($opts $displayFields); > } > } > > I have of course tried rebuilding all the dataobjects from square one > > PHP version -> PHP 4.3.10 (cgi) (built: Dec 21 2004 10:27:48) > > It's odd, as it seems to build the form and the -- New Value -- bit pops up. > But nothing's really functional. > > I had this problem with DB_DataObject_FormBuilder-0.11.5.tgz as well, which is > why I was using the older DB_DataObject_FormBuilder-0.10.3.tgz > > If it can be made to work, that will be a fantastic feature! > Well, it does work for me. ;-) It looks like your problem is with the primary key ($pk). You should have opened a bug report if the newer versions broke your scripts. Oh well, we'll try to fix it now. The problem is probably with _getPrimaryKey(). Please look into this function and see if you can find any reason it doesn't work with your DOs. It *looks* like one of these calls is returning '', an empty string (perhaps sequenceKey()?). I'd appreciate it if you could make the appropriate DO and send back the output of this: $do = DB_DataObject::factory('linkedTable'); echo 'PK '; var_dump($do->_primary_key); echo 'SK '; var_dump($do->sequenceKey()); echo 'K '; var_dump($do->keys()); Then try changing the _getPrimaryKey function in FormBuilder.php to this and see if it works: function _getPrimaryKey(&$do) { if (isset($do->_primary_key) && strlen($do->_primary_key)) { return $do->_primary_key; } elseif (($seq = $do->sequenceKey()) && isset($seq[0]) && strlen($seq[0])) { return $seq[0]; } else { if (($keys = $do->keys()) && isset($keys[0]) && strlen($keys[0])) { return $keys[0]; } } $this->debug('Error: Primary Key not found for table '.$do->tableName()); return false; } -- Justin Patrin

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