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

Exclude if at class level are not merge #1203

Closed
mpoiriert opened this issue May 20, 2020 · 5 comments · Fixed by #1204 or #1206
Closed

Exclude if at class level are not merge #1203

mpoiriert opened this issue May 20, 2020 · 5 comments · Fixed by #1204 or #1206
Labels

Comments

@mpoiriert
Copy link
Contributor

Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no

Steps required to reproduce the problem

  1. Create a class hierarchy of at leas 2 class (class B extends A)
  2. Configure class B @exclude(if=true)

Expected Result

  • Class B exclusion expression should be evaluate

Actual Result

  • Class B exclusion expression is not evaluated

Look trough the flow I found out that the merge in the class hierarchy doesn't merge the value of the exclusion. Any exclusion of the top class in the hierarchy will have precedence.

Unless it's the expected behaviour it bake it really hard to have more define rules of class exclusion of child object.

@mpoiriert mpoiriert changed the title Exclude if are not merge Exclude if at class level are not merge May 20, 2020
@goetas
Copy link
Collaborator

goetas commented May 23, 2020

I hope to have understood correctly the issue, but which class are you trying to serialize? A or B.

  • If A, then the expected behavior is that the exclusion rule is ignored
  • if B, then the rule should be considered

@goetas
Copy link
Collaborator

goetas commented May 23, 2020

see #1204

@goetas goetas added the bug label May 23, 2020
@mpoiriert
Copy link
Contributor Author

Yes this is exactly what I meant. Thanks for the quick fix / release.

@mpoiriert
Copy link
Contributor Author

Just installed it and now the problem is that class B always override even if no exclude if have been configured...

I presume it should be:

if($object->excludeIf) {
    $this->excludeIf = $object->excludeIf;
}

@goetas
Copy link
Collaborator

goetas commented May 24, 2020

Can you please check #1206 ?

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