PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Database » DB_DataObject_FormBuilder » Bug #4413

linkNewValue does not auto-fill in link ids

Details

Submitted2005-05-24 05:16 UTC
Fromspam-pear at darpa dot org
Assignedjustinpatrin
StatusBogus
PackageDB_DataObject_FormBuilder
PHP Version5.0.3
OSLinux/Debian
Roadmaps(Not assigned)

Comments

[2005-05-24 05:16 UTC] spam-pear at darpa dot org

Description:
------------
When using the linkNewValue option to generate new forms, it
does not auto-populate the table columns that should be linked
to the previous DB_DataObject. I have added the code below to
fix this.

- Dan Chmielewski

Reproduce code:
---------------
In QuickForm.php:
472 function _prepareForLinkNewValue($elName, $subTable) {
473 if (!isset($this->_linkNewValueDOs[$elName])) {
474 $this->_linkNewValueDOs[$elName] =& DB_DataObject::factory($subTable);
475
<!-- BEGIN PATCH -->
476 if (!is_array( $links = $this->_linkNewValueDOs[$elName]->links() )) {
477 $links = array();
478 }
479 foreach( $links as $field_key => $field ) {
480 $link = explode(':', $field);
481 $this->_linkNewValueDOs[$elName]->$field_key =
482 $this->_fb->_do->$link[1];
483 }
<!-- END PATCH -->
484 $this->_linkNewValueDOs[$elName]->fb_createSubmit = false;
485 $this->_linkNewValueDOs[$elName]->fb_elementNamePrefix = $this->elementNamePrefix.$elName.'_'.$subTable.'__';

Expected result:
----------------
The linked attribute/column ids should automatically be set to
the id of the parent object.

Actual result:
--------------
The linked attribute/column ids have no default setting. The
user must know to pick the right parent ID.