initial commit
[namibia] / module / Stock / src / Stock / Entity / PricingHistory.php
1 <?php
2 namespace Stock\Entity;
3
4 use Doctrine\ORM\Mapping as ORM;
5
6
7 /**
8  * A stock item.
9  *
10  * @ORM\Entity
11  * @ORM\HasLifecycleCallbacks
12  * @ORM\Table(name="vehicle_pricing_history")
13  */
14 class PricingHistory
15 {
16
17         /**
18          * Can archive records.
19          */
20         const ARCHIVE = true;
21         /**
22          * Pull Synchronization Strategy for this table.
23          */
24         const PULL_SYNCH_STRATEGY = false;
25         /**
26          * Push Synchronization Strategy for this table.
27          */
28         const PUSH_SYNCH_STRATEGY = false;
29         /**
30          * Post insert action must be called after new entity is flushed to database.
31          */
32         const HAVE_POST_INSERT = true;
33
34         /**
35          * @ORM\Id
36          * @ORM\Column(type="integer");
37          * @ORM\GeneratedValue(strategy="AUTO")
38          */
39         protected $id;
40
41         /**
42          * @ORM\Column(type="datetime", nullable=true, name="date");)
43          */
44         protected $date;
45         
46         /**
47          * @ORM\Column(type="decimal", scale=2, precision=11, nullable=false, name="trade", options={"unsigned"=true});
48          */
49         protected $trade = 0.0;
50
51     /**
52      * @ORM\Column(type="decimal", scale=2, precision=11, nullable=false, name="list_price", options={"unsigned"=true});
53      */
54     protected $listPrice = 0.0;
55
56         /**
57          * @ORM\Column(type="decimal", scale=2, precision=11, nullable=false, name="total_recon", options={"unsigned"=true});
58          */
59         protected $totalRecon = 0.0;
60         
61         /**
62          * @ORM\Column(type="integer", nullable=false, name="km", options={"unsigned"=true})
63          */
64         protected $km = 0;
65         
66         /**
67          * @ORM\Column(type="decimal", scale=2, precision=11, nullable=false, name="priceg_offer", options={"unsigned"=true});
68          */
69         protected $pricegOffer = 0.0;
70         
71         
72         /**
73          * @ORM\Column(type="decimal", scale=2, precision=11, nullable=false, name="auction_winbid", options={"unsigned"=true});
74          */
75         protected $auctionWinningBid = 0.0;
76         
77         
78         /**
79          * @ORM\Column(type="integer", nullable=false, name="stock_id");
80          */
81         protected $stockId = 0;
82         
83         
84         /**
85          * Magic getter to expose protected properties.
86          * @param string $property
87          * @return mixed
88          */
89         public function __get($property)
90         {
91                 return $this->$property;
92         }
93
94         /**
95          * Magic setter to save protected properties.
96          * @param string $property
97          * @param mixed $value
98          */
99         public function __set($property, $value)
100         {
101                 $this->$property = $value;
102         }
103
104         /**
105          * Convert the object to an array.
106          * @param array $expand
107          * @param array $intersect
108          * @return array
109          */
110         public function toArray(array $expand = array(), array $intersect = array())
111         {
112                 
113                 $includeAll = empty($intersect);
114                 $data = array();
115                 ($includeAll || isset($intersect['id']))
116                         && $data['id'] = $this->id;
117                 ($includeAll || isset($intersect['date']))
118                         && $data['date'] = $this->date;
119                 ($includeAll || isset($intersect['trade']))
120                         && $data['trade'] = $this->trade;
121         ($includeAll || isset($intersect['listPrice']))
122             && $data['listPrice'] = $this->listPrice;
123                 ($includeAll || isset($intersect['totalRecon']))
124                         && $data['totalRecon'] = $this->totalRecon;
125                 ($includeAll || isset($intersect['km']))
126                         && $data['km'] = $this->km;
127                 ($includeAll || isset($intersect['pricegOffer']))
128                         && $data['pricegOffer'] = $this->pricegOffer;
129                 ($includeAll || isset($intersect['auctionWinningBid']))
130                         && $data['auctionWinningBid'] = $this->auctionWinningBid;
131                 ($includeAll || isset($intersect['stockId']))
132                         && $data['stockId'] = $this->stockId;
133                 return $data;
134                 
135         }
136
137         /**
138          * Convert the object to an array for synchronization.
139          * @return array
140          */
141         public function toSynchArray()
142         {
143                 return array(
144                                 'id'   => $this->id,
145                                 'date' => $this->date,
146                                 'trade' => $this->trade,
147                 'listPrice' => $this->listPrice,
148                                 'totalRecon' => $this->totalRecon,
149                                 'km' => $this->km,
150                                 'pricegOffer' => $this->pricegOffer,
151                                 'auctionWinningBid' => $this->auctionWinningBid,
152                                 'stockId' => $this->stockId
153                 );
154         }
155
156         /**
157          * Populate from an array.
158          * @param array $data
159          */
160         public function fromArray($data = array())
161         {
162                 isset($data['id'])
163                         && $this->id = $data['id'];
164                 isset($data['date'])
165                         && $this->date  = $data['date'];
166                 isset($data['trade'])
167                         && $this->trade  = $data['trade'];
168         isset($data['listPrice'])
169             && $this->listPrice  = $data['listPrice'];
170                 isset($data['totalRecon'])
171                         && $this->totalRecon  = $data['totalRecon'];
172                 isset($data['km'])
173                         && $this->km  = $data['km'];
174                 isset($data['pricegOffer'])
175                         && $this->pricegOffer  = $data['pricegOffer'];
176                 isset($data['auctionWinningBid'])
177                         && $this->auctionWinningBid  = $data['auctionWinningBid'];
178                 isset($data['stockId'])
179                         && $this->stockId  = $data['stockId'];
180         }
181
182 }