Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created May 6, 2012 09:31
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/2621240 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2621240 to your computer and use it in GitHub Desktop.
Using annotations to define validation constraints - http://www.symfonycentral.com/symfony-does-validation.html
<?php
// src/MyCompany/BlogBundle/Entity/Article.php
use Symfony\Component\Validator\Constraints as Assert;
class Article
{
/**
* @Assert\NotBlank()
*/
public $title;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment