Development

#2834 ([PATCH] sfWidgetFormSchema::getFormFormatter() returns an unrelated object in some cases)

You must first sign up to be able to contribute.

Ticket #2834 (closed defect: fixed)

Opened 10 months ago

Last modified 8 months ago

[PATCH] sfWidgetFormSchema::getFormFormatter() returns an unrelated object in some cases

Reported by: jesse Assigned to: fabien
Priority: major Milestone: 1.1.0 beta3
Component: form Version: 1.1.0 DEV
Keywords: form, formatter Cc:
Qualification: Unreviewed

Description

This is a little difficult for me to describe. To replicate, in the implementation of sfForm::configure() do the following:

public function configure() {
   $this->getWidgetSchema()->getFormFormatter()->setHelpFormat('foo');
   if($this->getWidgetSchema()->getFormFormatter()->getHelpFormat() != 'foo')
      throw new Exception("WTF!?");
}

The code above, found in lib/widget/sfWidgetFormSchema.class.php will throw in r7164 because sfWidgetFormSchema::getFormFormatter() will create and return a new instance of the formatter specified by $this->getFormFormatterName() but it will not actually save that new instance anywhere. What it should do is, after creating the instance, save it by doing the following:

$this->formFormatters[$name] = new $class();

then returning as usual. The included patch makes the changes needed.

Attachments

sfWidgetFormSchema.class.php.getFormFormatter.patch (0.8 kB) - added by jesse on 01/23/08 23:35:55.
Patch to save when returning new instance.

Change History

01/23/08 23:35:55 changed by jesse

  • attachment sfWidgetFormSchema.class.php.getFormFormatter.patch added.

Patch to save when returning new instance.

04/04/08 14:57:30 changed by nicolas

  • status changed from new to closed.
  • resolution set to fixed.

(In [8284]) fixes #2834 - fixed wrong formatters references returned when calling sfWidgetFormSchema ->getFormFormatter*()

04/04/08 15:10:05 changed by fabien

  • milestone set to 1.1.0 beta3.