jablonka.czprosek.czf

freenet-router

Subversion Repositories:
[/] [trunk/] [freenet-router/] [var/] [www/] [freenet-router/] [Framework/] [Environment/] [Message.php] - Blame information for rev 2

 

Line No. Rev Author Line
12simandl<?php
2 
3namespace Phem\Environment;
4 
5use Doctrine\ORM\Mapping\Column;
6use Doctrine\ORM\Mapping\Entity;
7use Doctrine\ORM\Mapping\GeneratedValue;
8use Doctrine\ORM\Mapping\Id;
9use Doctrine\ORM\Mapping\Table;
10use Doctrine\ORM\Mapping\OneToMany;
11use Phem\Environment\Application;
12use Phem\Libraries\ImportExport\Json\JsonSerializableObject;
13use Phem\ToolSuite;
14 
15/**
16 * @author kubapet
17 * @Entity
18 * @Table(name="admin_event")
19 */
20class Message extends JsonSerializableObject
21{
22 
23 /**
24 * @Id
25 * @GeneratedValue
26 * @Column
27 * (type="integer")
28 */
29 private $id;
30 
31 /**
32 * @GeneratedValue
33 * @Column(type="datetime")
34 */
35 private $date;
36 
37 /** @Column(type="string") */
38 private $fromUsr;
39 
40 /**
41 * @Column(type="string")
42 */
43 private $toUsr;
44 
45 /**
46 * @Column(type="string")
47 */
48 private $subject;
49 
50 /**
51 * @Column(type="string")
52 */
53 private $text;
54 
55 /** @OneToMany(targetEntity="MessageArgs", mappedBy="message",cascade={"persist"}) */
56 private $args;
57 
58 /**
59 * @ManyToOne(targetEntity="Srovnavac\Models\Entities\Session", cascade={"persist", "remove"}, fetch="EAGER")
60 * @JoinColumn(name="session", referencedColumnName="id")
61 * @var Srovnavac\Models\Entities\Session
62 */
63 private $session;
64 
65 /**
66 * @Column (type="integer")
67 */
68 private $processed;
69 
70 function __construct()
71 {
72 $this->args = new \Doctrine\Common\Collections\ArrayCollection();
73 $this->processed = 1;
74 }
75 
76 public function getId()
77 {
78 return $this->id;
79 }
80 
81 public function setId($id)
82 {
83 $this->id = $id;
84 }
85 
86 public function getDate()
87 {
88 return $this->date;
89 }
90 
91 public function setDate($date)
92 {
93 $this->date = $date;
94 }
95 
96 public function getFromUsr()
97 {
98 return $this->fromUsr;
99 }
100 
101 public function setFromUsr($fromUsr)
102 {
103 $this->fromUsr = $fromUsr;
104 }
105 
106 public function getToUsr()
107 {
108 return $this->toUsr;
109 }
110 
111 public function setToUsr($toUsr)
112 {
113 $this->toUsr = $toUsr;
114 }
115 
116 public function getSubject()
117 {
118 return $this->subject;
119 }
120 
121 public function setSubject($subject)
122 {
123 $this->subject = $subject;
124 }
125 
126 public function getText()
127 {
128 return $this->text;
129 }
130 
131 public function setText($text)
132 {
133 $this->text = $text;
134 }
135 
136 public function getArgs()
137 {
138 return $this->args;
139 }
140 
141 public function setArgs($args)
142 {
143 $this->args = $args;
144 }
145 
146 public function getSession()
147 {
148 return $this->session;
149 }
150 
151 public function setSession(\Srovnavac\Models\Entities\Session $session)
152 {
153 $this->session = $session;
154 }
155 
156 public function getUsers()
157 {
158 return ToolSuite::getSubCollection(Application::getLoggedUsers(), 'Username', 'Username');
159 }
160 
161 public function jsonSerialize()
162 {
163 
164 $getters = get_class_methods($this);
165 $result = array();
166 
167 foreach ($getters as $getter)
168 {
169 if (strpos($getter, "get") === 0)
170 {
171 $propName = str_replace("get", "", $getter);
172 $propName{0} = strtolower($propName{0});
173// $result[$propName] = json_encode($this->$getter(),JSON_UNESCAPED_UNICODE);
174 if ($propName == "args")
175 $result[$propName] = $this->$getter()->toArray();
176 else
177 $result[$propName] = $this->$getter();
178 }
179 }
180 
181 return $result;
182 }
183 
184 public function getProcessed()
185 {
186 return $this->processed;
187 }
188 
189 public function setProcessed($processed)
190 {
191 $this->processed = $processed;
192 }
193 
194 
195}

Powered by WebSVN 2.2.1