We are using a text editor in our web form (Tiny MCE). The form needs to be asserted using Symfony 2 that the text does not exceed 5000 characters, like this:
* @Assert\Length(
* max = 5000,
* maxMessage = "Your text cannot be longer than {{ limit }} characters long"
* )
However, it appears the Tiny MCE is attaching HTML tags to the start of each new element which is affecting the assert. So a 4500 character piece of text is failing the validation due to the HTML tags being appended.
Is there a way of effectively striping out the HTML tags before Symfony does the assertions?