2 namespace PriceGuide\Entity;
4 use Doctrine\ORM\Mapping as ORM;
9 * A price guide club member.
12 * @ORM\HasLifecycleCallbacks
13 * @ORM\Table(name="price_guide_allowed_member")
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;
35 * @ORM\Column(type="integer");
36 * @ORM\GeneratedValue(strategy="AUTO")
41 * @ORM\Column(type="string", length=250);
46 * @ORM\Column(type="string", length=250);
51 * @ORM\Column(type="datetime");
56 * @ORM\Column(type="datetime", nullable=true);
61 * @ORM\Column(type="boolean");
63 protected $archived = false;
68 * Magic getter to expose protected properties.
70 * @param string $property
73 public function __get($property)
75 return $this->$property;
79 * Magic setter to save protected properties.
81 * @param string $property
84 public function __set($property, $value)
86 $this->$property = $value;
92 public function setCreateTime()
94 $this->created = new \DateTime("now");
100 public function setUpdateTime()
102 $this->updated = new \DateTime("now");
106 * Convert the object to an array.
107 * @param array $expand
108 * @param array $intersect
109 * @param boolean $showIdentifiers
110 * @param integer $expandAll
113 public function toArray(
114 array $expand = array(), array $intersect = array(),
115 $showIdentifiers = false, $expandAll = 0
118 $intersect = array_flip($intersect);
119 $dateTimeFormat = \Utility\Registry::getConfigParam('DateTimeFormat');
120 $includeAll = empty($intersect);
122 ($includeAll || isset($intersect['id']))
123 && $data['id'] = $this->id;
124 ($includeAll || isset($intersect['name']))
125 && $data['name'] = $this->name;
126 ($includeAll || isset($intersect['email']))
127 && $data['email'] = $this->email;
128 ($includeAll || isset($intersect['created']))
129 && $data['created'] = !is_null($this->created)
130 ? $this->created->format($dateTimeFormat)
132 ($includeAll || isset($intersect['updated']))
133 && $data['updated'] = !is_null($this->updated)
134 ? $this->updated->format($dateTimeFormat)
140 * Populate from an array.
143 public function fromArray($data = array())
146 && $this->id = $data['id'];
148 && $this->name = $data['name'];
149 isset($data['email'])
150 && $this->email = $data['email'];