Skip to content

Commit

Permalink
Merge pull request #72 from Recras/fix-sfformfieldschema
Browse files Browse the repository at this point in the history
Fix sfFormFieldSchema and related
  • Loading branch information
timmipetit authored Dec 10, 2024
2 parents efd67a6 + 0d05714 commit 67d1b70
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/form/sfForm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ public function getFormFieldSchema()
{
$values = $this->isBound ? $this->taintedValues : $this->defaults + $this->widgetSchema->getDefaults();

$this->formFieldSchema = new sfFormFieldSchema($this->widgetSchema, null, null, $values, $this->errorSchema);
$this->formFieldSchema = new sfFormFieldSchema($this->widgetSchema, null, '', $values, $this->errorSchema);
}

return $this->formFieldSchema;
Expand Down
6 changes: 3 additions & 3 deletions lib/form/sfFormField.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,15 @@ class sfFormField
* @param sfWidgetForm $widget A sfWidget instance
* @param sfFormField $parent The sfFormField parent instance (null for the root widget)
* @param string $name The field name
* @param string $value The field value
* @param string $values The field value
* @param sfValidatorError $error A sfValidatorError instance
*/
public function __construct(?sfWidgetForm $widget, ?sfFormField $parent = null, string $name, string $value, ?sfValidatorError $error = null)
public function __construct(sfWidgetForm $widget, ?sfFormField $parent = null, string $name = '', array $values = [], ?sfValidatorError $error = null)
{
$this->widget = $widget;
$this->parent = $parent;
$this->name = $name;
$this->value = $value;
$this->value = $values;
$this->error = $error;
}

Expand Down
13 changes: 9 additions & 4 deletions lib/form/sfFormFieldSchema.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,17 @@ class sfFormFieldSchema extends sfFormField implements ArrayAccess, Iterator, Co
* @param sfWidgetFormSchema $widget A sfWidget instance
* @param sfFormField $parent The sfFormField parent instance (null for the root widget)
* @param string $name The field name
* @param string $value The field value
* @param string $values The field value
* @param sfValidatorError $error A sfValidatorError instance
*/
public function __construct(?sfWidgetFormSchema $widget, ?sfFormField $parent = null, ?string $name = null, string $value, ?sfValidatorError $error = null)
{
parent::__construct($widget, $parent, $name, $value, $error);
public function __construct(
sfWidgetFormSchema $widget,
?sfFormField $parent = null,
string $name = '',
array $values = [],
?sfValidatorError $error = null
) {
parent::__construct($widget, $parent, $name, $values, $error);

$this->fieldNames = $widget->getPositions();
}
Expand Down

0 comments on commit 67d1b70

Please sign in to comment.