2 namespace Auction\Entity;
4 use Doctrine\ORM\Mapping as ORM;
11 * @ORM\HasLifecycleCallbacks
12 * @ORM\Table(name="auction_public_holiday")
18 * Can archive records.
20 const ARCHIVE = false;
22 * Pull Synchronization Strategy for this table.
24 const PULL_SYNCH_STRATEGY = false;
26 * Push Synchronization Strategy for this table.
28 const PUSH_SYNCH_STRATEGY = false;
32 * @ORM\Column(type="integer");
33 * @ORM\GeneratedValue(strategy="AUTO")
38 * @ORM\Column(type="string", nullable=true, length=50)
43 * @ORM\Column(type="date");
48 * @ORM\Column(type="datetime");
53 * @ORM\Column(type="datetime", nullable=true);
59 * Magic getter to expose protected properties.
60 * @param string $property
63 public function __get($property)
65 return $this->$property;
69 * Magic setter to save protected properties.
70 * @param string $property
73 public function __set($property, $value)
75 $this->$property = $value;
81 public function setCreateTime()
83 $this->created = new \DateTime("now");
89 public function setUpdateTime()
91 $this->updated = new \DateTime("now");
95 * Convert the object to an array.
96 * @param array $expand
97 * @param array $intersect
100 public function toArray(array $expand = array('attachment'), array $intersect = array())
102 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
103 $dateFormat = \Utility\Registry::getConfigParam('DateFormat');
104 $includeAll = empty($intersect);
106 ($includeAll || isset($intersect['id']))
107 && $data['id'] = $this->id;
108 ($includeAll || isset($intersect['name']))
109 && $data['name'] = $this->name;
110 ($includeAll || isset($intersect['holiday']))
111 && $data['holiday'] = !is_null($this->holiday)
112 ? $this->holiday->format($dateFormat)
114 ($includeAll || isset($intersect['created']))
115 && $data['created'] = !is_null($this->created)
116 ? $this->created->format($dateTimeFormat)
118 ($includeAll || isset($intersect['updated']))
119 && $data['updated'] = !is_null($this->updated)
120 ? $this->updated->format($dateTimeFormat)
126 * Populate from an array.
129 public function fromArray($data = array())
132 && $this->id = $data['id'];
134 && $this->name = $data['name'];
135 isset($data['holiday'])
136 && $this->holiday = is_object($data['holiday'])
138 : new \DateTime($data['holiday']);