Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created May 6, 2012 09:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/2621255 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2621255 to your computer and use it in GitHub Desktop.
Use a validator to validate an instance of an entity class - http://www.symfonycentral.com
<?php
/* ... rest of the controller */
$article = new Article();
/* do stuff to the Article entity instance */
$validator = $this->get('validator');
$errors = $validator->validate($author);
/* rest of the controller... */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment