time_open = new DateTime(); $this->time_close = new DateTime(); $this->riders = new ArrayCollection(); $this->outlets = new ArrayCollection(); $this->status_open = true; $this->flag_hub_view = false; $this->notif_number = ''; $this->payment_methods = new ArrayCollection(); $this->flag_hub_auto_assign = false; $this->flag_rider_auto_assign = false; } public function getRiders() { return $this->riders; } public function getAvailableRiders() { $crit = Criteria::create(); $crit->where(Criteria::expr()->eq('flag_available', true)); return $this->riders->matching($crit); } public function getActiveRiders() { $crit = Criteria::create(); $crit->where(Criteria::expr()->eq('flag_active', true)); return $this->riders->matching($crit); } public function getUsers() { return $this->users; } public function getUsersCount() { return $this->users->count(); } public function getJobOrders() { return $this->job_orders; } public function getOngoingJobOrders() { $crit = Criteria::create(); $crit->where(Criteria::expr()->notIn('status', [JOStatus::CANCELLED, JOStatus::FULFILLED])); return $this->job_orders->matching($crit); } public function getForAssignmentJobOrders() { $crit = Criteria::create(); $crit->where(Criteria::expr()->eq('status', JOStatus::RIDER_ASSIGN)); return $this->job_orders->matching($crit); } public function addOutlet(Outlet $outlet) { $this->outlets[] = $outlet; return $this; } public function getOutlets() { return $this->outlets; } public function setBranchCode($branch_code) { $this->branch_code = $branch_code; return $this; } public function getBranchCode() { return $this->branch_code; } public function setStatusOpen($status = true) { $this->status_open = $status; return $this; } public function isStatusOpen() { return $this->status_open; } public function setRiderSlots($rider_slots) { $this->rider_slots = $rider_slots; return $this; } public function getRiderSlots() { return $this->rider_slots; } public function setHubViewFlag($flag_hub_view = true) { $this->flag_hub_view = $flag_hub_view; return $this; } public function isHubView() { return $this->flag_hub_view; } public function setNotifNumber($notif_number) { $this->notif_number = $notif_number; return $this; } public function getNotifNumber() { return $this->notif_number; } public function getPaymentMethods() { return $this->payment_methods; } public function setPaymentMethods(array $payment_methods) { $this->payment_methods = new ArrayCollection(); foreach ($payment_methods as $payment_method) { $this->payment_methods->add($payment_method); } return $this; } public function clearPaymentMethods() { $this->payment_methods = new ArrayCollection(); return $this; } public function setHubAutoAssign($flag_hub_auto_assign = true) { $this->flag_hub_auto_assign = $flag_hub_auto_assign; return $this; } public function isHubAutoAssign() { return $this->flag_hub_auto_assign; } public function setRiderAutoAssign($flag_rider_auto_assign = true) { $this->flag_rider_auto_assign = $flag_rider_auto_assign; return $this; } public function isRiderAutoAssign() { return $this->flag_rider_auto_assign; } }