Convert Line breaks to html break for all field getters in Symfony project
- by Ben
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?