Re: Wiki - Configuring dataobject_formbuilder

From: Date: Thu, 01 Jun 2006 15:57:51 +0000
Subject: Re: Wiki - Configuring dataobject_formbuilder
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24226@lists.php.net to get a copy of this message
On 6/1/06, Michel D'HOOGE <m.dhooge@enertecgroup.com> wrote:
Hello I just read the wiki page on configuring DB_FB and wonder if the first example is correct... http://pear.reversefold.com/dokuwiki/doku.php?id=pear:db_dataobject_formbuilder:configuring_formbuilder It is written there that the first method to configure FB is "by setting member variables in an extended class". Then all the other described methods should be able to override these settings. However the constructor is defined as follows: function DB_DataObject_FormBuilder_MyDriver(&$do, $options = false) {
    parent::DB_DataObject_FormBuilder($do, $options);
    $this->linkDispayLevel = 2;
    $this->elementTypeMap['date'] = 'myDate';
} And thus the child class modifies the variables once the parent constructor returns, cancelling any modifications. According to me, the constructor should look like: function DB_DataObject_FormBuilder_MyDriver(&$do, $options = false) {
    $this->linkDispayLevel = 2;
    $this->elementTypeMap['date'] = 'myDate';
    parent::DB_DataObject_FormBuilder($do, $options);
} Any comment?
Yes, you're right. With the code in the wiki the variables in the extended class would override those set in PEAR::setStaticProperty() or the options passed into create(). I've altered the page to show both options. Let me know what you think. -- Justin Patrin

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