Skip to content

Conversation

morawskim
Copy link

Hello,

In some cases, we might need to check not only whether the entity exists, but also the state (for example is an article published).
This PR allows easily extend the default implementation for also check the entity state.

Everything is based on the Template method design pattern so require only extends the base class.
The default implementation always returns true, so each entity is valid.
Users can overwrite this method and also inject more services to validate the state of the fetched entity.
That is why I needed to remove the final keywords from the constraint and validator classes.

In some cases, we might need to check not only whether the entity
exists, but also the state (for example is an article published).
During validation, a method to verify the fetched entity is called.
The default implementation always returns true, so when you need custom
implementation you need to overwrite this method.
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.

1 participant