initial commit
[namibia] / module / Statistical / src / Statistical / Entity / Click.php
1 <?php
2 namespace Statistical\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * Click tracking for banner adverts.
10  * @ORM\Entity
11  * @ORM\Table(name="lib_click")
12  */
13 class Click
14 {
15
16         /**
17          * Can not archive records.
18          */
19         const ARCHIVE = false;
20         /**
21          * Pull Synchronization Strategy for this table.
22          */
23         const PULL_SYNCH_STRATEGY = false;
24         /**
25          * Push Synchronization Strategy for this table.
26          */
27         const PUSH_SYNCH_STRATEGY = false;
28
29
30         /**
31          * @ORM\Id
32          * @ORM\Column(type="integer");
33          * @ORM\GeneratedValue(strategy="AUTO")
34          */
35         protected $id;
36
37         /**
38          * @ORM\Column(type="string", nullable=true, length=100, name="banner_id")
39          */
40         protected $bannerId;
41
42         /**
43          * @ORM\Column(type="string", nullable=true, length=100, name="ip_address")
44          */
45         protected $ipAddress;
46
47         /**
48          * @ORM\Column(type="datetime");
49          */
50         protected $created;
51
52
53
54         /**
55          * Magic getter to expose protected properties.
56          * @param string $property
57          * @return mixed
58          */
59         public function __get($property)
60         {
61                 return $this->$property;
62         }
63
64         /**
65          * Magic setter to save protected properties.
66          * @param string $property
67          * @param mixed $value
68          */
69         public function __set($property, $value)
70         {
71                 $this->$property = $value;
72         }
73                 
74         
75         /**
76          * @ORM\PrePersist
77          */
78         public function setCreateTime()
79         {
80                 $this->created = new \DateTime("now");
81         }
82         /**
83          * Convert the object to an array.
84          * @param array $expand
85          * @param array $intersect
86          * @return array
87          */
88         public function toArray(array $expand = array(), array $intersect = array())
89         {
90                 $includeAll = empty($intersect);
91                 $data = array();
92                 ($includeAll || isset($intersect['id']))
93                         && $data['id'] = $this->id;
94                 ($includeAll || isset($intersect['ipAddress']))
95                         && $data['ipAddress'] = $this->ipAddress;
96                 ($includeAll || isset($intersect['bannerId']))
97                         && $data['bannerId'] = $this->bannerId;
98                 ($includeAll || isset($intersect['created']))
99                         && $data['created'] = $this->created;
100                 return $data;
101         }
102
103         /**
104          * Populate from an array.
105          * @param array $data
106          */
107         public function fromArray($data = array())
108         {
109                 isset($data['id'])
110                         && $this->id = $data['id'];
111                 isset($data['ipAddress'])
112                 && $this->ipAddress = $data['ipAddress'];
113                 isset($data['bannerId'])
114                 && $this->ipAddress = $data['bannerId'];
115                 isset($data['created'])
116                         && $this->created  = $data['created'];
117         }
118
119 }