Created
January 15, 2014 04:46
-
-
Save settermjd/8430918 to your computer and use it in GitHub Desktop.
A Zend Form created via annotations, modelling a very simple user record.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace MyApplication\Form; | |
use Zend\Form\Annotation; | |
/** | |
* @Annotation\Name("user") | |
* @Annotation\Hydrator("Zend\Stdlib\Hydrator\ObjectProperty") | |
*/ | |
class UserRecord | |
{ | |
/** | |
* @Annotation\Exclude() | |
*/ | |
public $id; | |
/** | |
* @Annotation\Filter({"name":"StringTrim"}) | |
* @Annotation\Validator({"name":"StringLength", "options":{"min":1, "max":25}}) | |
* @Annotation\Validator({"name":"Regex", "options":{"pattern":"/^[a-zA-Z][a-zA-Z0-9_-]{0,24}$/"}}) | |
* @Annotation\Attributes({"type":"text"}) | |
* @Annotation\Options({"label":"Username:"}) | |
*/ | |
public $username; | |
/** | |
* @Annotation\Filter({"name":"StringTrim"}) | |
* @Annotation\Validator({"name":"StringLength", "options":{"min":1, "max":25}}) | |
* @Annotation\Attributes({"type":"text"}) | |
* @Annotation\Options({"label":"Password:"}) | |
* @Annotation\Type("Zend\Form\Element\Password") | |
*/ | |
public $password; | |
/** | |
* @Annotation\Type("Zend\Form\Element\Email") | |
* @Annotation\Options({"label":"Email Address:"}) | |
*/ | |
public $email; | |
/** | |
* @Annotation\Type("Zend\Form\Element\Text") | |
* @Annotation\Options({"label":"Phone Number:"}) | |
*/ | |
public $phoneNumber; | |
/** | |
* @Annotation\Type("Zend\Form\Element\Text") | |
* @Annotation\Options({"label":"Social Security Number:"}) | |
*/ | |
public $ssn; | |
/** | |
* @Annotation\Type("Zend\Form\Element\Text") | |
* @Annotation\Options({"label":"First Name:"}) | |
*/ | |
public $firstName; | |
/** | |
* @Annotation\Type("Zend\Form\Element\Text") | |
* @Annotation\Options({"label":"Last Name:"}) | |
*/ | |
public $lastName; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment