2 namespace Dispute\Entity;
4 use Doctrine\ORM\Mapping as ORM;
12 * @ORM\HasLifecycleCallbacks
13 * @ORM\Table(name="dispute")
19 * Can archive records.
23 * Pull Synchronization Strategy for this table.
25 const PULL_SYNCH_STRATEGY = false;
27 * Push Synchronization Strategy for this table.
29 const PUSH_SYNCH_STRATEGY = false;
33 /* ------------------------------------ Identification ------------------------------------ */
36 * @ORM\Column(type="integer");
37 * @ORM\GeneratedValue(strategy="AUTO")
42 /* ------------------------------------ Ownership ------------------------------------ */
44 * @ORM\ManyToOne(targetEntity="\User\Entity\Profile")
45 * @ORM\JoinColumn(nullable=false, name="created_by_profile_id")
50 * @ORM\ManyToOne(targetEntity="\Company\Entity\Company")
51 * @ORM\JoinColumn(nullable=false, name="from_company_id")
53 protected $fromCompany;
56 * @ORM\ManyToOne(targetEntity="\Company\Entity\Company")
57 * @ORM\JoinColumn(nullable=false, name="against_company_id")
59 protected $againstCompany;
62 * @ORM\ManyToOne(targetEntity="\Auction\Entity\Auction")
63 * @ORM\JoinColumn(nullable=false, name="auction_id")
68 /* ------------------------------------ Data ------------------------------------ */
71 * @ORM\Column(type="text", name="complaint")
73 protected $complaint = '';
76 * @ORM\Column(type="text", name="resolution")
78 protected $resolution = '';
81 /* ------------------------------------ Tracking ------------------------------------ */
83 * @ORM\Column(nullable=true, type="string", length=25, name="status");
85 protected $jobState = 'Pending Payment';
88 * @ORM\Column(type="datetime");
93 * @ORM\Column(type="datetime", nullable=true);
98 * @ORM\Column(type="boolean");
100 protected $archived = false;
107 * Magic getter to expose protected properties.
109 * @param string $property
112 public function __get($property)
114 return $this->$property;
118 * Magic setter to save protected properties.
120 * @param string $property
121 * @param mixed $value
123 public function __set($property, $value)
125 $this->$property = $value;
131 public function setCreateTime()
133 $this->created = new \DateTime("now");
134 $this->fromCompany = \Utility\Registry::resolveCompanyContext();
135 $this->createdBy = \Utility\Registry::resolveProfileContext($this->createdBy);
141 public function setUpdateTime()
143 $this->updated = new \DateTime("now");
147 * Convert the object to an array.
148 * @param array $expand
149 * @param array $intersect
150 * @param boolean $showIdentifiers
151 * @param integer $expandAll
154 public function toArray(
155 array $expand = array(), array $intersect = array(),
156 $showIdentifiers = false, $expandAll = 0
159 $intersect = array_flip($intersect);
160 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
161 $includeAll = empty($intersect);
163 ($includeAll || isset($intersect['id']))
164 && $data['id'] = $this->id;
165 ($includeAll || isset($intersect['createdBy']))
166 && $data['createdBy'] = (in_array('createdBy', $expand) || $expandAll || $showIdentifiers)
167 && !is_null($this->createdBy)
168 ? (!$showIdentifiers ? $this->createdBy->toArray(
169 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
170 ) : $this->createdBy->id)
172 ($includeAll || isset($intersect['fromCompany']))
173 && $data['fromCompany'] = (in_array('fromCompany', $expand) || $expandAll || $showIdentifiers)
174 && !is_null($this->fromCompany)
175 ? (!$showIdentifiers ? $this->fromCompany->toArray(
176 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
177 ) : $this->fromCompany->id)
179 ($includeAll || isset($intersect['againstCompany']))
180 && $data['againstCompany'] = (in_array('againstCompany', $expand) || $expandAll || $showIdentifiers)
181 && !is_null($this->againstCompany)
182 ? (!$showIdentifiers ? $this->againstCompany->toArray(
183 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
184 ) : $this->againstCompany->id)
186 ($includeAll || isset($intersect['auction']))
187 && $data['auction'] = (in_array('auction', $expand) || $expandAll || $showIdentifiers)
188 && !is_null($this->auction)
189 ? (!$showIdentifiers ? $this->auction->toArray(
190 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
191 ) : $this->auction->id)
193 ($includeAll || isset($intersect['complaint']))
194 && $data['complaint'] = $this->complaint;
195 ($includeAll || isset($intersect['resolution']))
196 && $data['resolution'] = $this->resolution;
197 ($includeAll || isset($intersect['jobState']))
198 && $data['jobState'] = $this->jobState;
199 ($includeAll || isset($intersect['created']))
200 && $data['created'] = !is_null($this->created)
201 ? $this->created->format($dateTimeFormat)
203 ($includeAll || isset($intersect['updated']))
204 && $data['updated'] = !is_null($this->updated)
205 ? $this->updated->format($dateTimeFormat)
211 * Populate from an array.
214 public function fromArray($data = array())
217 && $this->id = $data['id'];
218 isset($data['createdBy'])
219 && $this->createdBy = $data['createdBy'];
220 isset($data['fromCompany'])
221 && $this->fromCompany = $data['fromCompany'];
222 isset($data['againstCompany'])
223 && $this->againstCompany = $data['againstCompany'];
224 isset($data['auction'])
225 && $this->auction = $data['auction'];
226 isset($data['complaint'])
227 && $this->complaint = $data['complaint'];
228 isset($data['resolution'])
229 && $this->resolution = $data['resolution'];