Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[ObjectMapper] Promoted properties do not seem to update #60790

Open
@rvanlaak

Description

@rvanlaak

Symfony version(s) affected

7.3.0

Description

Am using a input DTO (and API Platform), and it seems that solely the promoted property on the constructor of the Doctrine Entity does not get updated.

How to reproduce

Situation that does not work

With the code below the name on the Bar entity does not get changed.

final class BarUpdateInput
{
    public string $name;
}

#[ORM\Entity]
class Bar
{
    #[ORM\Id]
    public string $id;

    public function __construct(
        #[ORM\Column]
        public string $name;
    ) {
}

Situation that does work

final class BarUpdateInput
{
    public string $name;
}

#[ORM\Entity]
class Bar
{
    #[ORM\Id]
    public string $id;

    #[ORM\Column]
    public string $name;

    public function __construct(
        string $name,
    ) {
}

``

### Possible Solution

Probably the `ObjectMapper:87-101` code needs some tweaking to map changes on existing Doctrine entity objects as well.

### Additional Context

* api platform
* doctrine

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions