Skip to content

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
DMS\Filter Example
namespace App\Entity;
//Import Annotations
use DMS\Filter\Rules as Filter;
class User
* @Filter\StripTags()
* @Filter\Trim()
* @Filter\StripNewlines()
* @var string
public $name;
* @Filter\StripTags()
* @Filter\Trim()
* @Filter\StripNewlines()
* @var string
public $email;
//Get Doctrine Reader
$reader = new Annotations\AnnotationReader();
//Load AnnotationLoader
$loader = new Mapping\Loader\AnnotationLoader($reader);
$this->loader = $loader;
//Get a MetadataFactory
$metadataFactory = new Mapping\ClassMetadataFactory($loader);
//Get a Filter
$filter = new DMS\Filter\Filter($metadataFactory);
//Get your Entity
$user = new App\Entity\User();
$user->name = "My <b>name</b>";
$user->email = "";
//Filter you entity
echo $user->name; //"My name"
echo $user->email; //""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.