cust_vehicles = new ArrayCollection(); $this->batteries = new ArrayCollection(); $this->flag_mobile = true; } public function getID() { return $this->id; } public function setManufacturer($manufacturer) { $this->manufacturer = $manufacturer; return $this; } public function getManufacturer() { return $this->manufacturer; } public function setMake($make) { $this->make = $make; return $this; } public function getMake() { return $this->make; } public function setModelYearFrom($model_year_from) { $this->model_year_from = $model_year_from; return $this; } public function getModelYearFrom() { return $this->model_year_from; } public function setModelYearTo($model_year_to) { $this->model_year_to = $model_year_to; return $this; } public function getModelYearTo() { return $this->model_year_to; } public function getModelYearFormatted($has_dash = true) { if ($this->model_year_from == 0) { if ($this->model_year_to == 0) { if ($has_dash) return '-'; return ''; } return $this->model_year_to; } if ($this->model_year_to == 0) return $this->model_year_from; return $this->model_year_from . ' - ' . $this->model_year_to; } public function addBattery(Battery $battery) { $this->batteries[$battery->getID()] = $battery; return $this; } public function clearBatteries() { $this->batteries->clear(); return $this; } public function getBatteries() { return $this->batteries; } public function setDisplayMobile($bool = true) { $this->flag_mobile = $bool; return $this; } public function shouldDisplayMobile() { return $this->flag_mobile; } public function getCustomerVehicles() { return $this->cust_vehicles; } public function getActiveBatteries() { $crit = Criteria::create(); $crit->where(Criteria::expr()->eq('flag_active', true)); return $this->batteries->matching($crit); } }