Resolve "Rider rating" #813
2 changed files with 135 additions and 0 deletions
|
|
@ -46,25 +46,35 @@ class Rider
|
|||
*/
|
||||
protected $plate_number;
|
||||
|
||||
// hub that the rider is assigned to
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Hub", inversedBy="riders")
|
||||
* @ORM\JoinColumn(name="hub_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $hub;
|
||||
|
||||
// job orders that the rider has done
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="JobOrder", mappedBy="rider")
|
||||
*/
|
||||
protected $job_orders;
|
||||
|
||||
// picture of rider
|
||||
/**
|
||||
* @ORM\Column(type="string", nullable=true)
|
||||
*/
|
||||
protected $image_file;
|
||||
|
||||
// current rating of rider
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $curr_rating;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->job_orders = new ArrayCollection();
|
||||
$this->curr_rating = 0;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
|
|
@ -148,4 +158,15 @@ class Rider
|
|||
{
|
||||
return $this->image_file;
|
||||
}
|
||||
|
||||
public function setCurrentRating($rating)
|
||||
{
|
||||
$this->curr_rating = $rating;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCurrentRating()
|
||||
{
|
||||
return $this->curr_rating;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
114
src/Entity/RiderRating.php
Normal file
114
src/Entity/RiderRating.php
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use DateTime;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="rider_rating")
|
||||
*/
|
||||
class RiderRating
|
||||
{
|
||||
// unique id
|
||||
/**
|
||||
* @ORM\Id
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\GeneratedValue(strategy="AUTO")
|
||||
*/
|
||||
protected $id;
|
||||
|
||||
// rider the rating is for
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Rider", inversedBy="ratings")
|
||||
* @ORM\JoinColumn(name="rider_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $rider;
|
||||
|
||||
// customer who left the rating
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Customer", inversedBy="ratings")
|
||||
* @ORM\JoinColumn(name="customer_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $customer;
|
||||
|
||||
// job order the rating was created for
|
||||
/**
|
||||
* @ORM\OneToOne(targetEntity="JobOrder", inversedBy="rating")
|
||||
* @ORM\JoinColumn(name="jo_id", referencedColumnName="id")
|
||||
*/
|
||||
protected $job_order;
|
||||
|
||||
// date and time the rating was created
|
||||
/**
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
protected $date_create;
|
||||
|
||||
// customer's rating of rider
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
protected $rating;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->date_create = new DateTime();
|
||||
$this->rating = 0;
|
||||
}
|
||||
|
||||
public function getID()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setRider(Rider $rider)
|
||||
{
|
||||
$this->rider = $rider;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRider()
|
||||
{
|
||||
return $this->rider;
|
||||
}
|
||||
|
||||
public function setCustomer(Customer $customer)
|
||||
{
|
||||
$this->customer = $customer;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getCustomer()
|
||||
{
|
||||
return $this->customer;
|
||||
}
|
||||
|
||||
public function setJobOrder(JobOrder $job_order)
|
||||
{
|
||||
$this->job_order = $job_order;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getJobOrder()
|
||||
{
|
||||
return $this->job_order;
|
||||
}
|
||||
|
||||
public function getDateCreate()
|
||||
{
|
||||
return $this->date_create;
|
||||
}
|
||||
|
||||
public function setRating($rating)
|
||||
{
|
||||
$this->rating = $rating;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRating()
|
||||
{
|
||||
return $this->rating;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue