2 namespace Valuation\Entity;
4 use Doctrine\ORM\Mapping as ORM;
12 * @ORM\HasLifecycleCallbacks
13 * @ORM\Table(name="valuation_time_slots")
15 class ValuationTimeSlots
19 * Can archive records.
23 * Pull Synchronization Strategy for this table.
25 const PULL_SYNCH_STRATEGY = 'Build';
27 * Push Synchronization Strategy for this table.
29 const PUSH_SYNCH_STRATEGY = 'Update';
31 * Post insert action must be called after new entity is flushed to database.
33 const HAVE_POST_INSERT = true;
35 * Handle as a job queue for mobile devices.
37 const JOB_QUEUE = true;
39 /* ------------------------------------ Identification ------------------------------------ */
42 * @ORM\Column(type="integer");
43 * @ORM\GeneratedValue(strategy="AUTO")
48 * @ORM\Column(type="string", length=20, nullable=false, name="time_slot");
53 * @ORM\Column(type="string", length=20, nullable=false, name="time_slot_display_name");
55 protected $timeSlotDisplayName;
58 * @ORM\Column(type="datetime");
63 * @ORM\Column(type="datetime", nullable=true);
68 * @ORM\Column(type="boolean");
70 protected $archived = false;
74 * @ORM\OneToMany(targetEntity="ValuationAppointments", mappedBy="timeSlot", cascade={"all"}, fetch="EXTRA_LAZY")
76 protected $appointmentTimeSlot;
79 * Magic getter to expose protected properties.
81 * @param string $property
84 public function __get($property)
86 return $this->$property;
90 * Magic setter to save protected properties.
92 * @param string $property
95 public function __set($property, $value)
97 $this->$property = $value;
103 public function setCreateTime()
105 $this->created = new \DateTime("now");
111 public function setUpdateTime()
113 $this->updated = new \DateTime("now");
117 * Convert the object to an array.
118 * @param array $expand
119 * @param array $intersect
120 * @param boolean $showIdentifiers
121 * @param integer $expandAll
124 public function toArray(
125 array $expand = array(), array $intersect = array(),
126 $showIdentifiers = false, $expandAll = 0
129 $intersect = array_flip($intersect);
130 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
131 $includeAll = empty($intersect);
133 ($includeAll || isset($intersect['id']))
134 && $data['id'] = $this->id;
135 ($includeAll || isset($intersect['timeSlot']))
136 && $data['timeSlot'] = $this->timeSlot;
137 ($includeAll || isset($intersect['timeSlotDisplayName']))
138 && $data['timeSlotDisplayName'] = $this->timeSlotDisplayName;
140 ($includeAll || isset($intersect['created']))
141 && $data['created'] = !is_null($this->created)
142 ? $this->created->format($dateTimeFormat)
144 ($includeAll || isset($intersect['updated']))
145 && $data['updated'] = !is_null($this->updated)
146 ? $this->updated->format($dateTimeFormat)
148 ($includeAll || isset($intersect['archived']))
149 && $data['archived'] = $this->archived;
156 * Populate from an array.
159 public function fromArray($data = array())
162 && $this->id = $data['id'];
163 isset($data['timeSlot'])
164 && $this->timeSlot = $data['timeSlot'];
165 isset($data['timeSlotDisplayName'])
166 && $this->timeSlotDisplayName = $data['timeSlotDisplayName'];