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

[DoctrineBridge] DoctrineLoader can't access embedded object properties #31775

Copy link
Copy link
Closed
@Korbeil

Description

@Korbeil
Issue body actions

Symfony version(s) affected: 4.3.0

Description
I just upgraded my application to 4.3.0 and saw this bug.
We have a UserAddress entity:

/**
 * @ORM\Table(name="user_address")
 */
class UserAddress
{
    /**
     * @var Address
     *
     * @ORM\Embedded(class="Address")
     */
    private $address;

    // ...
}

with an embedded object Address:

/**
 * @ORM\Embeddable
 */
class Address
{
    /**
     * @var null|string
     *
     * @ORM\Column(name="first_name", type="string", length=255, nullable=true)
     */
    private $firstName;

    // ...
}

With new Doctrine auto-validation feature, it tries to access address.firstName property, but in https://github.com/symfony/symfony/blob/4.4/src/Symfony/Component/Validator/Mapping/PropertyMetadata.php#L39, we check if given property exists as it's given, so it can't work.

Possible Solution
Use symfony/property-accessor ? Instead of reflection metadata which does not contains embedded objects metadata.

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

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