2 namespace Auction\Entity;
4 use Doctrine\ORM\Mapping as ORM;
9 * A reply concerning an item on question..
12 * @ORM\HasLifecycleCallbacks
13 * @ORM\Table(name="auction_reply")
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="Question")
45 * @ORM\JoinColumn(nullable=false, name="auction_question_id")
50 * @ORM\ManyToOne(targetEntity="\User\Entity\Profile")
51 * @ORM\JoinColumn(nullable=false, name="profile_id")
56 /* ------------------------------------ Reply ------------------------------------ */
58 * @ORM\Column(type="text")
60 protected $reply = '';
63 /* ------------------------------------ Tracking ------------------------------------ */
66 * @ORM\Column(type="boolean");
68 protected $archived = false;
73 * Magic getter to expose protected properties.
75 * @param string $property
78 public function __get($property)
80 return $this->$property;
84 * Magic setter to save protected properties.
86 * @param string $property
89 public function __set($property, $value)
91 $this->$property = $value;
97 public function setCreateTime()
99 is_null($this->profile)
100 && $this->profile = \Utility\Registry::resolveProfileContext($this->profile);
104 * Convert the object to an array.
105 * @param array $expand
106 * @param array $intersect
107 * @param boolean $showIdentifiers
108 * @param integer $expandAll
111 public function toArray(
112 array $expand = array(), array $intersect = array(),
113 $showIdentifiers = false, $expandAll = 0
116 $intersect = array_flip($intersect);
117 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
118 $includeAll = empty($intersect);
120 ($includeAll || isset($intersect['id']))
121 && $data['id'] = $this->id;
122 ($includeAll || isset($intersect['profile']))
123 && $data['profile'] = (in_array('profile', $expand) || $expandAll || $showIdentifiers)
124 && !is_null($this->profile)
125 ? (!$showIdentifiers ? $this->profile->toArray(
126 $expand, $intersect, $showIdentifiers, ($expandAll - 1)
127 ) : $this->profile->id)
129 ($includeAll || isset($intersect['reply']))
130 && $data['reply'] = $this->reply;
135 * Populate from an array.
138 public function fromArray($data = array())
141 && $this->id = $data['id'];
142 isset($data['question'])
143 && $this->question = $data['question'];
144 isset($data['profile'])
145 && $this->profile = $data['profile'];
146 isset($data['reply'])
147 && $this->reply = $data['reply'];