| @@ 16-260 (lines=245) @@ | ||
| 13 | * @ORM\Entity @HasLifecycleCallbacks |
|
| 14 | * @ORM\Table(name="game_postvote_comment") |
|
| 15 | */ |
|
| 16 | class PostVoteComment implements InputFilterAwareInterface |
|
| 17 | { |
|
| 18 | protected $inputFilter; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @ORM\Id |
|
| 22 | * @ORM\Column(type="integer"); |
|
| 23 | * @ORM\GeneratedValue(strategy="AUTO") |
|
| 24 | */ |
|
| 25 | protected $id; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @ORM\ManyToOne(targetEntity="PostVotePost", inversedBy="comments") |
|
| 29 | * @ORM\JoinColumn(name="post_id", referencedColumnName="id", onDelete="CASCADE") |
|
| 30 | **/ |
|
| 31 | protected $post; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @ORM\ManyToOne(targetEntity="PostVote") |
|
| 35 | **/ |
|
| 36 | protected $postvote; |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @ORM\ManyToOne(targetEntity="PlaygroundUser\Entity\User") |
|
| 40 | * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id") |
|
| 41 | **/ |
|
| 42 | protected $user; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @ORM\Column(type="text", nullable=true) |
|
| 46 | */ |
|
| 47 | protected $ip; |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @ORM\Column(type="text", nullable=true) |
|
| 51 | */ |
|
| 52 | protected $message; |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @ORM\Column(name="created_at", type="datetime") |
|
| 56 | */ |
|
| 57 | protected $createdAt; |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @ORM\Column(name="updated_at", type="datetime") |
|
| 61 | */ |
|
| 62 | protected $updatedAt; |
|
| 63 | ||
| 64 | /** @PrePersist */ |
|
| 65 | public function createChrono() |
|
| 66 | { |
|
| 67 | $this->createdAt = new \DateTime("now"); |
|
| 68 | $this->updatedAt = new \DateTime("now"); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** @PreUpdate */ |
|
| 72 | public function updateChrono() |
|
| 73 | { |
|
| 74 | $this->updatedAt = new \DateTime("now"); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @return the unknown_type |
|
| 79 | */ |
|
| 80 | public function getId() |
|
| 81 | { |
|
| 82 | return $this->id; |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param unknown_type $id |
|
| 87 | */ |
|
| 88 | public function setId($id) |
|
| 89 | { |
|
| 90 | $this->id = $id; |
|
| 91 | ||
| 92 | return $this; |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * @return string unknown_type |
|
| 97 | */ |
|
| 98 | public function getIp() |
|
| 99 | { |
|
| 100 | return $this->ip; |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * @param string $ip |
|
| 105 | */ |
|
| 106 | public function setIp($ip) |
|
| 107 | { |
|
| 108 | $this->ip = $ip; |
|
| 109 | ||
| 110 | return $this; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * @return the unknown_type |
|
| 115 | */ |
|
| 116 | public function getUser() |
|
| 117 | { |
|
| 118 | return $this->user; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @param unknown_type $user |
|
| 123 | */ |
|
| 124 | public function setUser($user) |
|
| 125 | { |
|
| 126 | $this->user = $user; |
|
| 127 | ||
| 128 | return $this; |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * @return the unknown_type |
|
| 133 | */ |
|
| 134 | public function getPost() |
|
| 135 | { |
|
| 136 | return $this->post; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * @param unknown_type $post |
|
| 141 | */ |
|
| 142 | public function setPost($post) |
|
| 143 | { |
|
| 144 | // Check that there is no drawback using the cascading update from PostVoteEntry |
|
| 145 | $post->addComment($this); |
|
| 146 | $this->post = $post; |
|
| 147 | ||
| 148 | return $this; |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @return the unknown_type |
|
| 153 | */ |
|
| 154 | public function getPostvote() |
|
| 155 | { |
|
| 156 | return $this->postvote; |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * @param unknown_type $postvote |
|
| 161 | */ |
|
| 162 | public function setPostvote($postvote) |
|
| 163 | { |
|
| 164 | ||
| 165 | $this->postvote = $postvote; |
|
| 166 | ||
| 167 | return $this; |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * @return the unknown_type |
|
| 172 | */ |
|
| 173 | public function getMessage() |
|
| 174 | { |
|
| 175 | return $this->message; |
|
| 176 | } |
|
| 177 | ||
| 178 | /** |
|
| 179 | * @param unknown_type $message |
|
| 180 | */ |
|
| 181 | public function setMessage($message) |
|
| 182 | { |
|
| 183 | $this->message = $message; |
|
| 184 | ||
| 185 | return $this; |
|
| 186 | } |
|
| 187 | ||
| 188 | /** |
|
| 189 | * @return the unknown_type |
|
| 190 | */ |
|
| 191 | public function getCreatedAt() |
|
| 192 | { |
|
| 193 | return $this->createdAt; |
|
| 194 | } |
|
| 195 | ||
| 196 | /** |
|
| 197 | * @param unknown_type $createdAt |
|
| 198 | */ |
|
| 199 | public function setCreatedAt($createdAt) |
|
| 200 | { |
|
| 201 | $this->createdAt = $createdAt; |
|
| 202 | ||
| 203 | return $this; |
|
| 204 | } |
|
| 205 | ||
| 206 | /** |
|
| 207 | * @return the unknown_type |
|
| 208 | */ |
|
| 209 | public function getUpdatedAt() |
|
| 210 | { |
|
| 211 | return $this->updatedAt; |
|
| 212 | } |
|
| 213 | ||
| 214 | /** |
|
| 215 | * @param unknown_type $updatedAt |
|
| 216 | */ |
|
| 217 | public function setUpdatedAt($updatedAt) |
|
| 218 | { |
|
| 219 | $this->updatedAt = $updatedAt; |
|
| 220 | ||
| 221 | return $this; |
|
| 222 | } |
|
| 223 | ||
| 224 | /** |
|
| 225 | * Convert the object to an array. |
|
| 226 | * |
|
| 227 | * @return array |
|
| 228 | */ |
|
| 229 | public function getArrayCopy() |
|
| 230 | { |
|
| 231 | $obj_vars = get_object_vars($this); |
|
| 232 | ||
| 233 | return $obj_vars; |
|
| 234 | } |
|
| 235 | ||
| 236 | /** |
|
| 237 | * Populate from an array. |
|
| 238 | * |
|
| 239 | * @param array $data |
|
| 240 | */ |
|
| 241 | public function populate($data = array()) |
|
| 242 | { |
|
| 243 | } |
|
| 244 | ||
| 245 | public function setInputFilter(InputFilterInterface $inputFilter) |
|
| 246 | { |
|
| 247 | throw new \Exception("Not used"); |
|
| 248 | } |
|
| 249 | ||
| 250 | public function getInputFilter() |
|
| 251 | { |
|
| 252 | if (!$this->inputFilter) { |
|
| 253 | $inputFilter = new InputFilter(); |
|
| 254 | ||
| 255 | $this->inputFilter = $inputFilter; |
|
| 256 | } |
|
| 257 | ||
| 258 | return $this->inputFilter; |
|
| 259 | } |
|
| 260 | } |
|
| 261 | ||
| @@ 16-259 (lines=244) @@ | ||
| 13 | * @ORM\Entity @HasLifecycleCallbacks |
|
| 14 | * @ORM\Table(name="game_postvote_vote") |
|
| 15 | */ |
|
| 16 | class PostVoteVote implements InputFilterAwareInterface |
|
| 17 | { |
|
| 18 | protected $inputFilter; |
|
| 19 | ||
| 20 | /** |
|
| 21 | * @ORM\Id |
|
| 22 | * @ORM\Column(type="integer"); |
|
| 23 | * @ORM\GeneratedValue(strategy="AUTO") |
|
| 24 | */ |
|
| 25 | protected $id; |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @ORM\ManyToOne(targetEntity="PostVotePost", inversedBy="votes") |
|
| 29 | * |
|
| 30 | **/ |
|
| 31 | protected $post; |
|
| 32 | ||
| 33 | /** |
|
| 34 | * The link to the user is not explicit as it's possible to vote anonymously.... |
|
| 35 | * @ORM\Column(type="integer", nullable=true) |
|
| 36 | */ |
|
| 37 | protected $userId; |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @ORM\Column(type="text", nullable=true) |
|
| 41 | */ |
|
| 42 | protected $ip; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * @ORM\Column(type="text", nullable=true) |
|
| 46 | */ |
|
| 47 | protected $message; |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @ORM\Column(type="string", nullable=true) |
|
| 51 | */ |
|
| 52 | protected $note; |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @ORM\Column(name="created_at", type="datetime") |
|
| 56 | */ |
|
| 57 | protected $createdAt; |
|
| 58 | ||
| 59 | /** |
|
| 60 | * @ORM\Column(name="updated_at", type="datetime") |
|
| 61 | */ |
|
| 62 | protected $updatedAt; |
|
| 63 | ||
| 64 | /** @PrePersist */ |
|
| 65 | public function createChrono() |
|
| 66 | { |
|
| 67 | $this->createdAt = new \DateTime("now"); |
|
| 68 | $this->updatedAt = new \DateTime("now"); |
|
| 69 | } |
|
| 70 | ||
| 71 | /** @PreUpdate */ |
|
| 72 | public function updateChrono() |
|
| 73 | { |
|
| 74 | $this->updatedAt = new \DateTime("now"); |
|
| 75 | } |
|
| 76 | ||
| 77 | /** |
|
| 78 | * @return the unknown_type |
|
| 79 | */ |
|
| 80 | public function getId() |
|
| 81 | { |
|
| 82 | return $this->id; |
|
| 83 | } |
|
| 84 | ||
| 85 | /** |
|
| 86 | * @param unknown_type $id |
|
| 87 | */ |
|
| 88 | public function setId($id) |
|
| 89 | { |
|
| 90 | $this->id = $id; |
|
| 91 | ||
| 92 | return $this; |
|
| 93 | } |
|
| 94 | ||
| 95 | /** |
|
| 96 | * @return string unknown_type |
|
| 97 | */ |
|
| 98 | public function getIp() |
|
| 99 | { |
|
| 100 | return $this->ip; |
|
| 101 | } |
|
| 102 | ||
| 103 | /** |
|
| 104 | * @param string $ip |
|
| 105 | */ |
|
| 106 | public function setIp($ip) |
|
| 107 | { |
|
| 108 | $this->ip = $ip; |
|
| 109 | ||
| 110 | return $this; |
|
| 111 | } |
|
| 112 | ||
| 113 | /** |
|
| 114 | * @return the unknown_type |
|
| 115 | */ |
|
| 116 | public function getUserId() |
|
| 117 | { |
|
| 118 | return $this->userId; |
|
| 119 | } |
|
| 120 | ||
| 121 | /** |
|
| 122 | * @param unknown_type $userId |
|
| 123 | */ |
|
| 124 | public function setUserId($userId) |
|
| 125 | { |
|
| 126 | $this->userId = $userId; |
|
| 127 | ||
| 128 | return $this; |
|
| 129 | } |
|
| 130 | ||
| 131 | /** |
|
| 132 | * @return the unknown_type |
|
| 133 | */ |
|
| 134 | public function getPost() |
|
| 135 | { |
|
| 136 | return $this->post; |
|
| 137 | } |
|
| 138 | ||
| 139 | /** |
|
| 140 | * @param unknown_type $post |
|
| 141 | */ |
|
| 142 | public function setPost($post) |
|
| 143 | { |
|
| 144 | // Check that there is no drawback using the cascading update from PostVoteEntry |
|
| 145 | $post->addVote($this); |
|
| 146 | $this->post = $post; |
|
| 147 | ||
| 148 | return $this; |
|
| 149 | } |
|
| 150 | ||
| 151 | /** |
|
| 152 | * @return the unknown_type |
|
| 153 | */ |
|
| 154 | public function getMessage() |
|
| 155 | { |
|
| 156 | return $this->message; |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * @param unknown_type $message |
|
| 161 | */ |
|
| 162 | public function setMessage($message) |
|
| 163 | { |
|
| 164 | $this->message = $message; |
|
| 165 | ||
| 166 | return $this; |
|
| 167 | } |
|
| 168 | ||
| 169 | /** |
|
| 170 | * @return the unknown_type |
|
| 171 | */ |
|
| 172 | public function getNote() |
|
| 173 | { |
|
| 174 | return $this->note; |
|
| 175 | } |
|
| 176 | ||
| 177 | /** |
|
| 178 | * @param unknown_type $note |
|
| 179 | */ |
|
| 180 | public function setNote($note) |
|
| 181 | { |
|
| 182 | $this->note = $note; |
|
| 183 | ||
| 184 | return $this; |
|
| 185 | } |
|
| 186 | ||
| 187 | /** |
|
| 188 | * @return the unknown_type |
|
| 189 | */ |
|
| 190 | public function getCreatedAt() |
|
| 191 | { |
|
| 192 | return $this->createdAt; |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * @param unknown_type $createdAt |
|
| 197 | */ |
|
| 198 | public function setCreatedAt($createdAt) |
|
| 199 | { |
|
| 200 | $this->createdAt = $createdAt; |
|
| 201 | ||
| 202 | return $this; |
|
| 203 | } |
|
| 204 | ||
| 205 | /** |
|
| 206 | * @return the unknown_type |
|
| 207 | */ |
|
| 208 | public function getUpdatedAt() |
|
| 209 | { |
|
| 210 | return $this->updatedAt; |
|
| 211 | } |
|
| 212 | ||
| 213 | /** |
|
| 214 | * @param unknown_type $updatedAt |
|
| 215 | */ |
|
| 216 | public function setUpdatedAt($updatedAt) |
|
| 217 | { |
|
| 218 | $this->updatedAt = $updatedAt; |
|
| 219 | ||
| 220 | return $this; |
|
| 221 | } |
|
| 222 | ||
| 223 | /** |
|
| 224 | * Convert the object to an array. |
|
| 225 | * |
|
| 226 | * @return array |
|
| 227 | */ |
|
| 228 | public function getArrayCopy() |
|
| 229 | { |
|
| 230 | $obj_vars = get_object_vars($this); |
|
| 231 | ||
| 232 | return $obj_vars; |
|
| 233 | } |
|
| 234 | ||
| 235 | /** |
|
| 236 | * Populate from an array. |
|
| 237 | * |
|
| 238 | * @param array $data |
|
| 239 | */ |
|
| 240 | public function populate($data = array()) |
|
| 241 | { |
|
| 242 | } |
|
| 243 | ||
| 244 | public function setInputFilter(InputFilterInterface $inputFilter) |
|
| 245 | { |
|
| 246 | throw new \Exception("Not used"); |
|
| 247 | } |
|
| 248 | ||
| 249 | public function getInputFilter() |
|
| 250 | { |
|
| 251 | if (!$this->inputFilter) { |
|
| 252 | $inputFilter = new InputFilter(); |
|
| 253 | ||
| 254 | $this->inputFilter = $inputFilter; |
|
| 255 | } |
|
| 256 | ||
| 257 | return $this->inputFilter; |
|
| 258 | } |
|
| 259 | } |
|
| 260 | ||