]> git.immae.eu Git - github/wallabag/wallabag.git/blame - src/Wallabag/GroupBundle/Entity/Invitation.php
Fixed typos
[github/wallabag/wallabag.git] / src / Wallabag / GroupBundle / Entity / Invitation.php
CommitLineData
2041810a
TC
1<?php
2
3namespace Wallabag\GroupBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6
7/**
8 * @ORM\Entity
2585953e 9 * @ORM\Table(name="invitation")
2041810a
TC
10 */
11class Invitation
12{
13 /**
14 * @ORM\Id
15 * @ORM\Column(type="string", length=6)
16 */
17 protected $code;
18
19 /**
20 * @var \DateTime
21 * @ORM\Column(type="datetime")
22 */
23 protected $date;
24
25 /**
26 * @ORM\OneToOne(targetEntity="UserGroup", mappedBy="invitation")
27 */
28 protected $userGroup;
29
30 public function __construct(UserGroup $userGroup)
31 {
32 // generate identifier only once, here a 6 characters length code
33 $this->code = substr(md5(uniqid(rand(), true)), 0, 6);
34 $this->date = new \DateTime();
35 $this->userGroup = $userGroup;
36 }
37
38 public function getCode()
39 {
40 return $this->code;
41 }
42
43 /**
44 * @return \DateTime
45 */
2585953e 46 public function getDate()
2041810a
TC
47 {
48 return $this->date;
49 }
50
51 /**
52 * @param \DateTime $date
53 */
54 public function setDate(\DateTime $date)
55 {
56 $this->date = $date;
57 }
58
59 /**
60 * @return mixed
61 */
2585953e 62 public function getUserGroup()
2041810a
TC
63 {
64 return $this->userGroup;
65 }
66
67 /**
68 * @param mixed $userGroup
69 */
70 public function setUserGroup(UserGroup $userGroup)
71 {
72 $this->userGroup = $userGroup;
73 }
74}