Fix associations for JORejection to JobOrder #183

This commit is contained in:
Ramon Gutierrez 2019-02-12 00:12:58 +08:00
parent b63695e846
commit 345ca27a31
2 changed files with 21 additions and 1 deletions

View file

@ -6,10 +6,12 @@ use Doctrine\ORM\Mapping as ORM;
use DateTime;
/**
* @ORM\Entity(repositoryClass="App\Repository\JORejectionRepository")
* @ORM\Entity
* @ORM\Table(name="jo_rejection")
*/
class JORejection
{
// unique id
/**
* @ORM\Id()
* @ORM\GeneratedValue()
@ -17,39 +19,46 @@ class JORejection
*/
protected $id;
// date the entry was created
/**
* @ORM\Column(type="datetime")
*/
protected $date_create;
// user who rejected hub
/**
* @ORM\ManyToOne(targetEntity="User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", nullable=true)
*/
protected $user;
// hub that was rejected
/**
* @ORM\ManyToOne(targetEntity="Hub")
* @ORM\JoinColumn(name="hub_id", referencedColumnName="id", nullable=true)
*/
protected $hub;
// job order where hub was rejected
/**
* @ORM\ManyToOne(targetEntity="JobOrder", inversedBy="hub_rejections")
* @ORM\JoinColumn(name="jo_id", referencedColumnName="id", nullable=true)
*/
protected $job_order;
// generic reason for this rejection
/**
* @ORM\Column(type="string", length=255)
*/
protected $reason;
// remarks about this rejection
/**
* @ORM\Column(type="text", nullable=true)
*/
protected $remarks;
// contact person of hub about this rejection
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/

View file

@ -262,6 +262,12 @@ class JobOrder
*/
protected $facilitated_by;
// hubs rejected for this job order
/**
* @ORM\OneToMany(targetEntity="JORejection", mappedBy="job_order")
*/
protected $hub_rejections;
public function __construct()
{
$this->date_create = new DateTime();
@ -776,4 +782,9 @@ class JobOrder
{
return $this->facilitated_by;
}
public function getHubRejections()
{
return $this->hub_rejections;
}
}