-
-
Notifications
You must be signed in to change notification settings - Fork 312
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
Twig filter access to serializer #62
Conversation
* | ||
* Basically provides access to JMSSerializer from Twig | ||
*/ | ||
class Serializer extends \Twig_Extension { |
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.
Can you suffix this class with "Extension", i.e. "SerializerExtension"?
Thanks for this patch. Could you clean up your commits a bit to follow the Symfony2 coding style (especially 4 spaces for indentation)? |
{ | ||
$this->mockSerializer = $this->getMock('JMS\SerializerBundle\Serializer\SerializerInterface'); | ||
} | ||
public function testSerialize() |
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.
missing empty line between the methods, and the indentation is wrong
Thanks for the feedback. Suggested coding standards changed, and naming fixed. I've also added a short bit of documentation to the main doc file. |
Twig filter access to serializer
Thanks, merged. |
I've created a very basic twig extension that provides "wrapper" access to the serializer service via a twig filter.
It allows for
{{ Entity | serialize | raw }}
inside twig templatesI'm not sure if I need to setup some other config, or make this optional somehow. Suggestions/comments welcome.