Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't excludePolicy("all") on embedded or nested documents #1433

Open
Pillotm opened this issue Sep 22, 2022 · 0 comments
Open

Can't excludePolicy("all") on embedded or nested documents #1433

Pillotm opened this issue Sep 22, 2022 · 0 comments

Comments

@Pillotm
Copy link

Pillotm commented Sep 22, 2022

Bug report? yes

Steps required to reproduce the problem

  1. deserialize an object with some embedded attributes values different than BDD values

Expected Result

Not excluded attributes in embedded document are not update as expected
*

Actual Result

The attributes not exposed are still updated
*

exemple :

/** @ExclusionPolicy("all") */
class Contract{
    /**
     *
     * @Serializer\Type("App\Document\Embedded\ContractPeriod")
     * @Serializer\SerializedName("contractPeriod")
     * @Expose()
     */
    private $contractPeriod;

    /**
     *
     * @Serializer\Type("App\Document\Embedded\ContractPeriod")
     * @Serializer\SerializedName("contractPeriod")
     */
    private $testNotExposed;

**In this case we are in the main document so the not exposed value will not be updated with deserialization**
}

/** @ExclusionPolicy("all") */
class ContractPeriod {
    /**
     * @Serializer\Type("string")
     * @Serializer\SerializedName("label")
     * @Expose()
     */
    private $label;

    /**
     * @var DateTime|null
     * @Groups({"contract"})
     *
     * @ODM\Field(type="date", nullable=true)
     */
    private $otherNotExposeTest;

**In this case we are in the Embedded document and the not exposed value is always updated with deserialization**

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant