|
| 1 | +<?php |
| 2 | +namespace PlaygroundUser\Entity; |
| 3 | + |
| 4 | +use BjyAuthorize\Acl\HierarchicalRoleInterface; |
| 5 | +use Doctrine\ORM\Mapping as ORM; |
| 6 | +use Doctrine\ORM\Mapping\HasLifecycleCallbacks; |
| 7 | +use Doctrine\ORM\Mapping\PrePersist; |
| 8 | +use Doctrine\ORM\Mapping\PreUpdate; |
| 9 | +use Zend\InputFilter\InputFilter; |
| 10 | +use Zend\InputFilter\Factory as InputFactory; |
| 11 | +use Zend\InputFilter\InputFilterAwareInterface; |
| 12 | +use Zend\InputFilter\InputFilterInterface; |
| 13 | + |
| 14 | +/** |
| 15 | + * An entity that represents a user log. |
| 16 | + * |
| 17 | + * @ORM\Entity @HasLifecycleCallbacks |
| 18 | + * @ORM\Table(name="user_log") |
| 19 | + * |
| 20 | + */ |
| 21 | +class UserLog implements InputFilterAwareInterface |
| 22 | +{ |
| 23 | + protected $inputFilter; |
| 24 | + |
| 25 | + /** |
| 26 | + * @var int |
| 27 | + * @ORM\Id |
| 28 | + * @ORM\Column(type="integer") |
| 29 | + * @ORM\GeneratedValue(strategy="AUTO") |
| 30 | + */ |
| 31 | + protected $id; |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + /** |
| 36 | + * Get the id. |
| 37 | + * |
| 38 | + * @return int |
| 39 | + */ |
| 40 | + public function getId() |
| 41 | + { |
| 42 | + return $this->id; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @ORM\ManyToOne(targetEntity="PlaygroundUser\Entity\User") |
| 47 | + * @ORM\JoinColumn(name="user_id", referencedColumnName="user_id", onDelete="CASCADE") |
| 48 | + **/ |
| 49 | + protected $user; |
| 50 | + |
| 51 | + /** |
| 52 | + * @ORM\Column(name="controller_class", type="string", length=255) |
| 53 | + */ |
| 54 | + protected $controllerClass; |
| 55 | + |
| 56 | + /** |
| 57 | + * @ORM\Column(name="module_name", type="string", length=255) |
| 58 | + */ |
| 59 | + protected $moduleName; |
| 60 | + |
| 61 | + /** |
| 62 | + * @ORM\Column(name="route_name", type="string", length=255) |
| 63 | + */ |
| 64 | + protected $routeName; |
| 65 | + |
| 66 | + /** |
| 67 | + * @ORM\Column(name="area_name", type="string", length=255) |
| 68 | + */ |
| 69 | + protected $areaName; |
| 70 | + |
| 71 | + /** |
| 72 | + * @ORM\Column(type="text") |
| 73 | + */ |
| 74 | + protected $uri; |
| 75 | + |
| 76 | + /** |
| 77 | + * @ORM\Column(name="action_name", type="string", length=255) |
| 78 | + */ |
| 79 | + protected $actionName; |
| 80 | + |
| 81 | + /** |
| 82 | + * @ORM\Column(name="created_at", type="datetime", nullable=true) |
| 83 | + */ |
| 84 | + protected $createdAt; |
| 85 | + |
| 86 | + /** |
| 87 | + * @ORM\Column(name="updated_at", type="datetime", nullable=true) |
| 88 | + */ |
| 89 | + protected $updatedAt; |
| 90 | + |
| 91 | + /** @PrePersist */ |
| 92 | + public function createChrono() |
| 93 | + { |
| 94 | + $this->createdAt = new \DateTime("now"); |
| 95 | + $this->updatedAt = new \DateTime("now"); |
| 96 | + } |
| 97 | + |
| 98 | + /** @PreUpdate */ |
| 99 | + public function updateChrono() |
| 100 | + { |
| 101 | + $this->updatedAt = new \DateTime("now"); |
| 102 | + } |
| 103 | + |
| 104 | + /** |
| 105 | + * Set the id. |
| 106 | + * |
| 107 | + * @param int $id |
| 108 | + * |
| 109 | + * @return void |
| 110 | + */ |
| 111 | + public function setId($id) |
| 112 | + { |
| 113 | + $this->id = (int) $id; |
| 114 | + |
| 115 | + return $this; |
| 116 | + } |
| 117 | + |
| 118 | + /** |
| 119 | + * @return the $user |
| 120 | + */ |
| 121 | + public function getUser() |
| 122 | + { |
| 123 | + return $this->user; |
| 124 | + } |
| 125 | + |
| 126 | + /** |
| 127 | + * @param field_type $user |
| 128 | + */ |
| 129 | + public function setUser($user) |
| 130 | + { |
| 131 | + $this->user = $user; |
| 132 | + |
| 133 | + return $this; |
| 134 | + } |
| 135 | + |
| 136 | + public function getControllerClass() |
| 137 | + { |
| 138 | + return $this->controllerClass; |
| 139 | + } |
| 140 | + |
| 141 | + public function setControllerClass($controllerClass) |
| 142 | + { |
| 143 | + $this->controllerClass = $controllerClass; |
| 144 | + |
| 145 | + return $this; |
| 146 | + } |
| 147 | + |
| 148 | + public function getModuleName() |
| 149 | + { |
| 150 | + return $this->moduleName; |
| 151 | + } |
| 152 | + |
| 153 | + public function setModuleName($moduleName) |
| 154 | + { |
| 155 | + $this->moduleName = $moduleName; |
| 156 | + |
| 157 | + return $this; |
| 158 | + } |
| 159 | + |
| 160 | + public function getRouteName() |
| 161 | + { |
| 162 | + return $this->routeName; |
| 163 | + } |
| 164 | + |
| 165 | + public function setRouteName($routeName) |
| 166 | + { |
| 167 | + $this->routeName = $routeName; |
| 168 | + |
| 169 | + return $this; |
| 170 | + } |
| 171 | + |
| 172 | + public function getAreaName() |
| 173 | + { |
| 174 | + return $this->areaName; |
| 175 | + } |
| 176 | + |
| 177 | + public function setAreaName($areaName) |
| 178 | + { |
| 179 | + $this->areaName = $areaName; |
| 180 | + |
| 181 | + return $this; |
| 182 | + } |
| 183 | + |
| 184 | + public function getUri() |
| 185 | + { |
| 186 | + return $this->uri; |
| 187 | + } |
| 188 | + |
| 189 | + public function setUri($uri) |
| 190 | + { |
| 191 | + $this->uri = $uri; |
| 192 | + |
| 193 | + return $this; |
| 194 | + } |
| 195 | + |
| 196 | + public function getActionName() |
| 197 | + { |
| 198 | + return $this->actionName; |
| 199 | + } |
| 200 | + |
| 201 | + public function setActionName($actionName) |
| 202 | + { |
| 203 | + $this->actionName = $actionName; |
| 204 | + |
| 205 | + return $this; |
| 206 | + } |
| 207 | + |
| 208 | + /** |
| 209 | + * Convert the object to an array. |
| 210 | + * |
| 211 | + * @return array |
| 212 | + */ |
| 213 | + public function getArrayCopy() |
| 214 | + { |
| 215 | + $obj_vars = get_object_vars($this); |
| 216 | + |
| 217 | + return $obj_vars; |
| 218 | + } |
| 219 | + |
| 220 | + public function setInputFilter(InputFilterInterface $inputFilter) |
| 221 | + { |
| 222 | + throw new \Exception("Not used"); |
| 223 | + } |
| 224 | + |
| 225 | + public function getInputFilter() |
| 226 | + { |
| 227 | + if (!$this->inputFilter) { |
| 228 | + $inputFilter = new InputFilter(); |
| 229 | + $factory = new InputFactory(); |
| 230 | + |
| 231 | + $this->inputFilter = $inputFilter; |
| 232 | + } |
| 233 | + |
| 234 | + return $this->inputFilter; |
| 235 | + } |
| 236 | +} |
0 commit comments