initial commit
[namibia] / module / PriceGuide / src / PriceGuide / Entity / ClubMember.php
1 <?php
2 namespace PriceGuide\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7
8 /**
9  * @ORM\Entity
10  * @ORM\Table(name="price_guide_club_members")
11  */
12 class ClubMember
13 {
14
15         /**
16          * Can archive records.
17          */
18         const ARCHIVE = true;
19         /**
20          * Pull Synchronization Strategy for this table.
21          */
22         const PULL_SYNCH_STRATEGY = false;
23         /**
24          * Push Synchronization Strategy for this table.
25          */
26         const PUSH_SYNCH_STRATEGY = false;
27
28
29         /**
30          * @ORM\Id
31          * @ORM\Column(type="integer");
32          * @ORM\GeneratedValue(strategy="AUTO")
33          */
34         protected $id;
35
36         /**
37          * @ORM\ManyToOne(targetEntity="Club", inversedBy="members")
38          * @ORM\JoinColumn(name="price_guide_club_id", referencedColumnName="id")
39          **/
40         protected $club;
41
42         /**
43          * @ORM\ManyToOne(targetEntity="Member", inversedBy="clubs")
44          * @ORM\JoinColumn(name="price_guide_member_id", referencedColumnName="id")
45          **/
46         protected $member;
47
48         /**
49          * @ORM\Column(type="boolean");
50          */
51         protected $archived = false;
52
53
54
55         /**
56          * Magic getter to expose protected properties.
57          * @param string $property
58          * @return mixed
59          */
60         public function __get($property)
61         {
62                 return $this->$property;
63         }
64
65         /**
66          * Magic setter to save protected properties.
67          * @param string $property
68          * @param mixed $value
69          */
70         public function __set($property, $value)
71         {
72                 $this->$property = $value;
73         }
74
75         /**
76          * Convert the object to an array.
77          * @param array $expand
78          * @param array $intersect
79          * @return array
80          */
81         public function toArray(array $expand = array(), array $intersect = array())
82         {
83                 $includeAll = empty($intersect);
84                 $data = array();
85                 ($includeAll || isset($intersect['id']))
86                         && $data['id'] = $this->id;
87                 ($includeAll || isset($intersect['priceGuideStock']))
88                         && $data['priceGuideStock'] = $this->priceGuideStock->toArray($expand, $intersect);
89                 ($includeAll || isset($intersect['club']))
90                         && $data['club'] = $this->club->toArray($expand, $intersect);
91                 return $data;
92         }
93
94         /**
95          * Populate from an array.
96          * @param array $data
97          */
98         public function fromArray($data = array())
99         {
100                 isset($data['id'])
101                         && $this->id = $data['id'];
102                 isset($data['priceGuideStock'])
103                         && $this->priceGuideStock  = $data['priceGuideStock'];
104                 isset($data['club'])
105                         && $this->club  = $data['club'];
106         }
107
108 }