Annotation trong Doctrine 2

/**
* @Assert\NotBlank()
*/

/**
* @Assert\Choice(
*     choices = { “male”, “female” },
*     message = “Choose a valid gender.”
* )
*/

/**
* @Assert\Choice({“male”, “female”})
*/

/**
* @Assert\NotBlank()
* @Assert\Length(min = “3”)
*/

/**
* @Assert\True(message = “The password cannot match your first name”)
*/
public function isPasswordLegal()
{
// return true or false
}

/**
* @Assert\Email(groups={“registration”})
*/
private $email;

/**
* @Assert\NotBlank(groups={“registration”})
* @Assert\Length(min=7, groups={“registration”})
*/
private $password;

/**
* @Assert\Length(min = “2”)
*/
private $city;

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s