2 namespace Stock\Entity;
4 use Doctrine\ORM\Mapping as ORM;
10 * @ORM\Table(name="stock_damages")
16 * Can archive records.
20 * Pull Synchronization Strategy for this table.
22 const PULL_SYNCH_STRATEGY = 'Build';
24 * Push Synchronization Strategy for this table.
26 const PUSH_SYNCH_STRATEGY = 'Build';
31 * @ORM\Column(type="integer");
32 * @ORM\GeneratedValue(strategy="AUTO")
37 * @ORM\ManyToOne(targetEntity="Stock", inversedBy="damages")
38 * @ORM\JoinColumn(name="stock_id", referencedColumnName="id")
43 * @ORM\ManyToOne(targetEntity="Damage")
44 * @ORM\JoinColumn(name="vehicle_damage_id", referencedColumnName="id")
49 * @ORM\Column(type="decimal", scale=2, precision=11, nullable=false, options={"unsigned"=true});
51 protected $amount = 0.0;
54 * @ORM\Column(type="boolean");
56 protected $archived = false;
61 * Magic getter to expose protected properties.
62 * @param string $property
65 public function __get($property)
67 return $this->$property;
71 * Magic setter to save protected properties.
72 * @param string $property
75 public function __set($property, $value)
77 $this->$property = $value;
81 * Convert the object to an array.
82 * @param array $expand
83 * @param array $intersect
86 public function toArray(
87 array $expand = array(), array $intersect = array(), $showIdentifiers = false
90 $includeAll = empty($intersect);
92 ($includeAll || isset($intersect['id']))
93 && $data['id'] = $this->id;
94 ($includeAll || isset($intersect['damage']))
95 && $data['damage'] = $showIdentifiers
97 : $this->damage->toArray();
98 ($includeAll || isset($intersect['amount']))
99 && $data['amount'] = $this->amount;
104 * Convert the object to an array for synchronization.
107 public function toSynchArray()
111 'name' => $this->name
116 * Populate from an array.
119 public function fromArray($data = array())
122 && $this->id = $data['id'];
123 isset($data['stock'])
124 && $this->stock = $data['stock'];
125 isset($data['damage'])
126 && $this->damage = $data['damage'];
127 isset($data['amount'])
128 && $this->amount = $data['amount'];