Re: DB_DataObject without ini file

From: Date: Fri, 10 Feb 2006 01:46:55 +0000
Subject: Re: DB_DataObject without ini file
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22920@lists.php.net to get a copy of this message
Justin Patrin a écrit :
On 2/8/06, Alan Knowles <alan@akbkhome.com> wrote:
there is a config option 'proxy' that may work. - just set it to 'full'. Theoretically it will also create class definitions on the fly if no class is found in the include path.
    
That problem with this option is that it pulls the column information from the database every time you run the script. This really isn't a great option for production scripts as data types won't often change. I finally wrote this tiny child class to autowrite the table() and keys() method. It seems to work.
Do I have something to do with sequenceKey()? I have a notice "undefined index "db name" (/path/to/DataObject.php::1999) when using DB_DataObject_FormBuilder. <?php require_once 'DB/DataObject/Generator.php'; class DB_DataObject_Generator_extended extends DB_DataObject_Generator { function derivedHookFunctions() {
           $def=$this->_generateDefinitionsTable();
           $s = "\n\tfunction table(){";
           foreach($def['table']as $col => $type) {
               $s .= '$ret[\''.$col.'\']=' . $type . ';';
           }
           $s .= 'return $ret;}';
           $s .= "\n\tfunction keys(){";
           foreach($def['keys']as $key => $type) {
               $s .= '$ret[]=\'' . $key . '\';';
           }
           $s .= 'return $ret;';
           $s .= "}";
           return $s;
} } ?> ___________________________________________________________________________ Nouveau : téléphonez moins cher avec Yahoo! Messenger ! Découvez les tarifs exceptionnels pour appeler la France et l'international. Téléchargez sur http://fr.messenger.yahoo.com

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