resq/src/Entity/Hub.php

64 lines
1.2 KiB
PHP

<?php
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 DateTime;
/**
* @ORM\Entity
* @ORM\Table(name="hub")
*/
class Hub
{
use Location;
// riders assigned to this hub
/**
* @ORM\OneToMany(targetEntity="Rider", mappedBy="hub")
*/
protected $riders;
// job orders assigned to hub
/**
* @ORM\OneToMany(targetEntity="JobOrder", mappedBy="hub")
*/
protected $job_orders;
/**
* @ORM\ManyToMany(targetEntity="User", mappedBy="hubs", fetch="EXTRA_LAZY")
*/
protected $users;
public function __construct()
{
$this->time_open = new DateTime();
$this->time_close = new DateTime();
$this->riders = new ArrayCollection();
$this->outlets = new ArrayCollection();
}
public function getRiders()
{
return $this->riders;
}
public function getUsers()
{
return $this->users;
}
public function getUsersCount()
{
return $this->users->count();
}
public function getJobOrders()
{
return $this->job_orders;
}
}