Add branch field to hub and outlet, create location trait
This commit is contained in:
parent
fa5122235a
commit
7bf2b7aa5d
3 changed files with 160 additions and 238 deletions
|
|
@ -2,64 +2,20 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Ramcar\Location;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
use DateTime;
|
||||
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="hub")
|
||||
*/
|
||||
class Hub
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name of hub
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// address
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
// address coordinates
|
||||
/**
|
||||
* @ORM\Column(type="point")
|
||||
*/
|
||||
protected $coordinates;
|
||||
|
||||
// contact numbers
|
||||
// this is displayed in a textarea
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200)
|
||||
*/
|
||||
protected $contact_nums;
|
||||
|
||||
// opening time
|
||||
/**
|
||||
* @ORM\Column(type="time")
|
||||
*/
|
||||
protected $time_open;
|
||||
|
||||
// closing time
|
||||
/**
|
||||
* @ORM\Column(type="time")
|
||||
*/
|
||||
protected $time_close;
|
||||
use Location;
|
||||
|
||||
// riders assigned to this hub
|
||||
/**
|
||||
|
|
@ -75,81 +31,10 @@ class Hub
|
|||
|
||||
public function __construct()
|
||||
{
|
||||
$this->riders = new ArrayCollection();
|
||||
$this->time_open = new DateTime();
|
||||
$this->time_close = new DateTime();
|
||||
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->address = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
public function setCoordinates(Point $point)
|
||||
{
|
||||
$this->coordinates = $point;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCoordinates()
|
||||
{
|
||||
return $this->coordinates;
|
||||
}
|
||||
|
||||
public function setContactNumbers($nums)
|
||||
{
|
||||
$this->contact_nums = $nums;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getContactNumbers()
|
||||
{
|
||||
return $this->contact_nums;
|
||||
}
|
||||
|
||||
public function setTimeOpen(DateTime $time_open)
|
||||
{
|
||||
$this->time_open = $time_open;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeOpen()
|
||||
{
|
||||
return $this->time_open;
|
||||
}
|
||||
|
||||
public function setTimeClose(DateTime $time_close)
|
||||
{
|
||||
$this->time_close = $time_close;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeClose()
|
||||
{
|
||||
return $this->time_close;
|
||||
$this->riders = new ArrayCollection();
|
||||
$this->outlets = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getRiders()
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace App\Entity;
|
||||
|
||||
use App\Ramcar\Location;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
|
|
@ -15,55 +15,7 @@ use DateTime;
|
|||
*/
|
||||
class Outlet
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name of enrollee
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// address
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
// address coordinates
|
||||
/**
|
||||
* @ORM\Column(type="point")
|
||||
*/
|
||||
protected $coordinates;
|
||||
|
||||
// contact numbers
|
||||
// this is displayed in a textarea
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $contact_nums;
|
||||
|
||||
// opening time
|
||||
/**
|
||||
* @ORM\Column(type="time")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $time_open;
|
||||
|
||||
// closing time
|
||||
/**
|
||||
* @ORM\Column(type="time")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $time_close;
|
||||
use Location;
|
||||
|
||||
// job orders assigned to outlet
|
||||
/**
|
||||
|
|
@ -81,78 +33,12 @@ class Outlet
|
|||
{
|
||||
$this->time_open = new DateTime();
|
||||
$this->time_close = new DateTime();
|
||||
$this->job_orders = new ArrayCollection();
|
||||
}
|
||||
|
||||
|
||||
public function getID()
|
||||
public function getJobOrders()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->address = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
public function setCoordinates(Point $point)
|
||||
{
|
||||
$this->coordinates = $point;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCoordinates()
|
||||
{
|
||||
return $this->coordinates;
|
||||
}
|
||||
|
||||
public function setContactNumbers($nums)
|
||||
{
|
||||
$this->contact_nums = $nums;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getContactNumbers()
|
||||
{
|
||||
return $this->contact_nums;
|
||||
}
|
||||
|
||||
public function setTimeOpen(DateTime $time_open)
|
||||
{
|
||||
$this->time_open = $time_open;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeOpen()
|
||||
{
|
||||
return $this->time_open;
|
||||
}
|
||||
|
||||
public function setTimeClose(DateTime $time_close)
|
||||
{
|
||||
$this->time_close = $time_close;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeClose()
|
||||
{
|
||||
return $this->time_close;
|
||||
return $this->job_orders;
|
||||
}
|
||||
|
||||
public function setHub(Hub $hub)
|
||||
|
|
|
|||
151
src/Ramcar/Location.php
Normal file
151
src/Ramcar/Location.php
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
<?php
|
||||
|
||||
namespace App\Ramcar;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Symfony\Component\Validator\Constraints as Assert;
|
||||
|
||||
use CrEOF\Spatial\PHP\Types\Geometry\Point;
|
||||
use DateTime;
|
||||
|
||||
trait Location
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// name of location
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $name;
|
||||
|
||||
// branch name
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $branch;
|
||||
|
||||
// address
|
||||
/**
|
||||
* @ORM\Column(type="string", length=80)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $address;
|
||||
|
||||
// address coordinates
|
||||
/**
|
||||
* @ORM\Column(type="point")
|
||||
*/
|
||||
protected $coordinates;
|
||||
|
||||
// contact numbers
|
||||
// this is displayed in a textarea
|
||||
/**
|
||||
* @ORM\Column(type="string", length=200)
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $contact_nums;
|
||||
|
||||
// opening time
|
||||
/**
|
||||
* @ORM\Column(type="time")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $time_open;
|
||||
|
||||
// closing time
|
||||
/**
|
||||
* @ORM\Column(type="time")
|
||||
* @Assert\NotBlank()
|
||||
*/
|
||||
protected $time_close;
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
public function setBranch($branch)
|
||||
{
|
||||
$this->branch = $branch;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBranch()
|
||||
{
|
||||
return $this->branch;
|
||||
}
|
||||
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->address = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
public function setCoordinates(Point $point)
|
||||
{
|
||||
$this->coordinates = $point;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCoordinates()
|
||||
{
|
||||
return $this->coordinates;
|
||||
}
|
||||
|
||||
public function setContactNumbers($nums)
|
||||
{
|
||||
$this->contact_nums = $nums;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getContactNumbers()
|
||||
{
|
||||
return $this->contact_nums;
|
||||
}
|
||||
|
||||
public function setTimeOpen(DateTime $time_open)
|
||||
{
|
||||
$this->time_open = $time_open;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeOpen()
|
||||
{
|
||||
return $this->time_open;
|
||||
}
|
||||
|
||||
public function setTimeClose(DateTime $time_close)
|
||||
{
|
||||
$this->time_close = $time_close;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimeClose()
|
||||
{
|
||||
return $this->time_close;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue