Re: FB, limiting crosslink options table

From: Date: Wed, 15 Feb 2006 17:08:50 +0000
Subject: Re: FB, limiting crosslink options table
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22989@lists.php.net to get a copy of this message
Heya, On 2/15/06, d30 <dean@glasistre.hr> wrote: > > Hi, I'm new to DO + FB and I have a question if is poslible in some simple > way to > do whereAdd() on the options table? > > from /DB/DataObject/FormBuilder.php > ----------------------------------------- > 1 * > 2 * @return array strings representing all of the records in $table. > 3 * @access protected > 4 */ > 5 function _getSelectOptions($table, $displayFields = false, > $selectAddEmpty = false, $field = false, $valueField = false) { > 6 $opts =& DB_DataObject::factory($table); > 7 $opts->whereAdd("Something = 'N'"); > 8 ^^^^^^^^^^^^^^^ # query on the options table > 9 > 10 if (is_a($opts, 'db_dataobject')) { > 11 if > ($this->isCallableAndExists($this->prepareLinkedDataObjectCallback)) { > 12 > call_user_func_array($this->prepareLinkedDataObjectCallback, array(&$opts, > $field)); > 13 } > 14 if ($valueField === false) { > 15 $valueField = $this->_getPrimaryKey($opts); > 16 } > > I don't want do display all the resolts from the table > > I have try with adding $linkedDataObject->whereAdd("Something = 'N'") in > prepareLinkedDataObject(), but this add the "Something = 'N'" to both > tables (linking and options? table). You shouldn't need to edit the FormBuilder.php file... Within your DataObjects_[your table name] extends DB_DataObject class file that was created by the DB DataObject generator, add in something like this below the ###END_AUTOCODE section: function prepareLinkedDataObject(&$linkedDataObject, $field) { if ($linkedDataObject->tableName() == 'options_table_name') { $linkedDataObject->whereAdd("Something = 'N'"); } } With that you should be able to add in the callback you need. thanks, > d30 > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- -Brett http:saltybeagle.com aim:ianswerq

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