Modify the association between Warranty and PrivacyPolicy to ManyToOne. Add getters and setters for warranty in PrivacyPolicy. #256

This commit is contained in:
Korina Cordero 2019-08-28 02:15:26 +00:00
parent 6398c58b32
commit 918f95e425
2 changed files with 20 additions and 4 deletions

View file

@ -48,6 +48,16 @@ class PrivacyPolicy
*/
protected $cust_promo;
/**
* @ORM\OneToMany(targetEntity="Warranty", mappedBy="privacy_policy")
*/
protected $warranties;
public function __construct()
{
$this->warranties = new ArrayCollection();
}
public function getID()
{
return $this->id;
@ -108,9 +118,15 @@ class PrivacyPolicy
return $this->cust_promo;
}
public function addWarranty(Warranty $warranty)
{
$this->warranties[] = $warranty;
return $this;
}
public function getWarrantiess()
{
return $this->warranties;
}
}

View file

@ -129,7 +129,7 @@ class Warranty
// privacy policy
/**
* @ORM\OneToOne(targetEntity="PrivacyPolicy")
* @ORM\ManyToOne(targetEntity="PrivacyPolicy", inversedBy="warranties")
* @ORM\JoinColumn(name="warranty_privacy_policy", referencedColumnName="id", nullable=true)
*/
protected $privacy_policy;