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
Introduce LinkHelper #96
Conversation
Useful to generate URLs based on configured relations Should fix #91
👍 |
I will add a EL function that reuses such helper. It should fix the other issue. |
So, it needs more tests but it works. |
@adrienbrault I guess I'm done here. |
/** | ||
* @author William Durand <william.durand1@gmail.com> | ||
*/ | ||
class LinkHelper implements ExpressionFunctionInterface |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you mix the helper and the ExpressionFunctionInterface
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because adding a proxy class that implements the interface is probably too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, so you only apply the SRP when it's not too much ?
Maybe the ExpressionFunctionInterface
was too much and that it could have been done like in Symfony by extending the base ExpressionLanguage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Injecting helpers into the extended EL class?
I dont think it violates SRP, it is a helper that provides one feature, exposed as a PHP method and as a EL function. Its responsability is to provide this feature. I could introduce a Hateoas\Expression\Function\Link
class if you wish, but really it won't do much.
The EL function is pretty awesome ... because it is so annoying to repeat links everywhere! 👍 |
Get
href
values from configured links.Useful to generate URLs based on configured relations.
Should fix #83 and #91
WDYT?