Convert Line breaks to html break for all field getters in Symfony project

Posted by Ben on Stack Overflow See other posts from Stack Overflow or by Ben
Published on 2010-05-06T00:31:24Z Indexed on 2010/05/06 2:48 UTC
Read the original article Hit count: 313

Filed under:

I am working on a Symfony project and I currently have this:

<?php echo preg_replace('/\n/','<br />', $review->getComments()); ?>

and would very much like to be able to make all getters add html line breaks so i don't have to pepper my code with preg_replace. the $object->getFieldname methods are work automatically so I am looking to extend this somewhere to globally add a new method. What is the best approach here?

© Stack Overflow or respective owner

Related posts about symfony