Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Don't require an object property to be readable for writing #36754

Copy link
Copy link
Closed
@ph-fritsche

Description

@ph-fritsche
Issue body actions

Description

As dicussed in #36492 the Symfony\Component\Form\Extension\Core\PropertyPathMapper does not behave as expected.
When trying to write form values to an object it fails if the property is not readable.

The current implementation tries to get the value to avoid setting an identical value.

PropertyPathMapper should catch any exceptions that are specific to reading the property when trying to write it.

It might set an identical value.
If writing fails, an exception will still be thrown as expected.

Example

class Foo1 {
    public int $bar;
}

One should be able to map a form with bar=123 to Foo1, but it will fail with UninitializedPropertyException.

class Foo2 {
    private $bar;
    public function setBaz($value) {
        $this->bar = $value * 2;
    }
}

One should be able to map a form with baz=123 to Foo2, but it will fail with a NoSuchPropertyException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FormRFCRFC = Request For Comments (proposals about features that you want to be discussed)RFC = Request For Comments (proposals about features that you want to be discussed)Stalled

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.