Created
June 24, 2012 15:55
-
-
Save Ocramius/2983803 to your computer and use it in GitHub Desktop.
Annotations in ZendFramework 2 and Doctrine
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 BlitzEvent\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Zend\Form\Anotation; | |
/** | |
* | |
* @ORM\Entity(repositoryClass="BlitzEvent\Repository\Event") | |
* @ORM\Table(name="event") | |
*/ | |
class Event | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
private $id; | |
/** | |
* @Annotation|Attributes({"type":"text"}) // duplicate | |
* @Annotation|Filter({"name":"StringTrim"}) // duplicate | |
* @Annotation\Validator({"name":"NotEmpty"}) // duplicate | |
* @Annotation\Validator({"name":"StringLength"}) // duplicate | |
* @ORM\Column(type="string", length=25) | |
*/ | |
private $name; | |
/** | |
* @Annotation|Attributes({"type":"text"}) // duplicate | |
* @Annotation|StringTrim // duplicate | |
* @Annotation\Validator({"name":"NotEmpty"}) // duplicate | |
* @ORM\Column(type="text") | |
*/ | |
private $description; | |
/** | |
* @ORM\Column(type="datetime", name="freeze_at") | |
*/ | |
private $freezeAt; | |
/** | |
* @ORM\Column(type="datetime", name="invite_at") | |
*/ | |
private $inviteAt; | |
/** | |
* @ORM\Column(type="datetime", name="start_at") | |
*/ | |
private $startAt; | |
/** | |
* @Annotation|Attributes({"type":"text"}) // duplicate | |
* @Annotation\Filter({"name":"Int"}) // duplicate | |
* @Annotation\Validator({"name":"Int"}) // duplicate | |
* @Annotation\Validator({"name":"NotEmpty"}) // duplicate | |
* @ORM\Column(type="integer") | |
*/ | |
private $duration; | |
/** | |
* @Annotation|Attributes({"type":"text"}) // duplicate | |
* @Annotation\Filter({"name":"Int"}) // duplicate | |
* @Annotation\Validator({"name":"Int"}) // duplicate | |
* @Annotation\Validator({"name":"NotEmpty"}) // duplicate | |
* @ORM\Column(type="integer", name="max_signups") | |
*/ | |
private $maxSignups; | |
/** | |
* @ORM\ManyToOne(targetEntity="BlitzGame\Entity\Game") | |
* @ORM\JoinColumn(nullable=false) | |
*/ | |
private $game; | |
/** | |
* @ORM\ManyToOne(targetEntity="BlitzUser\Entity\User") | |
* @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", nullable=false) | |
*/ | |
private $user; | |
/** | |
* @ORM\OneToMany(targetEntity="BlitzEvent\Entity\EventSignup", mappedBy="event") | |
*/ | |
private $signups; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment