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

#98 - Allow applying further filters after DoctrineProxyFilter #101

Merged
merged 1 commit into from
May 31, 2018

Conversation

fsevestre
Copy link
Contributor

Closes #98

This is a proposal for allowing applying further filters after DoctrineProxyFilter.
If you have a better interface name idea, I will be happy to rename it.

@theofidry theofidry self-requested a review April 14, 2018 23:33
@theofidry theofidry self-assigned this Apr 14, 2018
@fsevestre
Copy link
Contributor Author

ping @theofidry (sorry :( )

Copy link
Collaborator

@theofidry theofidry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologize for the late review and thank you very much for your contribution!

There is two minor naming changes I would like you to make, otherwise I think it's only missing a mention in the doc. Maybe a not in the Doctrine filter doc + adding a mention in the filter doc that except a few exceptions listed in the filter descriptions, matching a filter will stop the chain of filters (i.e. the next ones will not be applied)

/**
* Defines a filter that update the source object state only.
*/
interface ObjectFilter extends Filter
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about ChainableFilter as to any filter implementing this interface will not stop the chain of filters, i.e. if there is a filter registered after this one it will be applied?

@@ -207,6 +208,8 @@ private function copyObjectProperty($object, ReflectionProperty $property)
return;
}

$hasAppliedFilter = false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor but I would prefer$filterWasApplied


$copier = new DeepCopy();
$copier->addFilter(new DoctrineProxyFilter(), new DoctrineProxyMatcher());
$copier->addFilter(new SetNullFilter(), new PropertyNameMatcher('id'));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I should add this filter since we are in the DoctrineProxyFilter part, but I believe that they will be used together most of the time.

@fsevestre
Copy link
Contributor Author

@theofidry Comments addressed.
Please tell me if I have missed something or if I should rewrite the doc.

@theofidry
Copy link
Collaborator

All good :)

@theofidry
Copy link
Collaborator

Actually this is a BC break. I've released 1.8.0 and merge 1.x back to 2.x. 2.x is now the master in which we can merge your PR.

I'll handle the merge tonight or tomorrow, I hope we can push some further changes in 2.x and have a new release soon :)

@theofidry
Copy link
Collaborator

It can be targeted to 2.x now :)

@fsevestre fsevestre changed the base branch from 1.x to 2.x May 31, 2018 17:45
@fsevestre
Copy link
Contributor Author

@theofidry Done.
I had some rebase conflicts, you might want to double check ;)

@theofidry theofidry merged commit a8ab59b into myclabs:2.x May 31, 2018
@theofidry
Copy link
Collaborator

Many thanks!

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

Successfully merging this pull request may close these issues.

None yet

2 participants