2 namespace Stock\Entity;
4 use Doctrine\ORM\Mapping as ORM;
10 * @ORM\Table(name="stock_accessories")
16 * Can archive records.
18 const ARCHIVE = false;
20 * Pull Synchronization Strategy for this table.
22 const PULL_SYNCH_STRATEGY = false;
24 * Push Synchronization Strategy for this table.
26 const PUSH_SYNCH_STRATEGY = false;
31 * @ORM\Column(type="integer");
32 * @ORM\GeneratedValue(strategy="AUTO")
37 * @ORM\ManyToOne(targetEntity="Stock", inversedBy="accessories")
38 * @ORM\JoinColumn(name="stock_id", referencedColumnName="id")
43 * @ORM\ManyToOne(targetEntity="Accessory")
44 * @ORM\JoinColumn(name="vehicle_accessory_id", referencedColumnName="id")
51 * Magic getter to expose protected properties.
52 * @param string $property
55 public function __get($property)
57 return $this->$property;
61 * Magic setter to save protected properties.
62 * @param string $property
65 public function __set($property, $value)
67 $this->$property = $value;
71 * Convert the object to an array.
72 * @param array $expand
73 * @param array $intersect
76 public function toArray(
77 array $expand = array(), array $intersect = array(), $showIdentifiers = false
80 $includeAll = empty($intersect);
82 ($includeAll || isset($intersect['id']))
83 && $data['id'] = $this->id;
84 ($includeAll || isset($intersect['accessory']))
85 && $data['accessory'] = $showIdentifiers
86 ? $this->accessory->id
87 : $this->accessory->toArray();
92 * Populate from an array.
95 public function fromArray($data = array())
98 && $this->id = $data['id'];
100 && $this->stock = $data['stock'];
101 isset($data['accessory'])
102 && $this->accessory = $data['accessory'];