From e0294062caef5288be352af18c0eb2cb90c1acb9 Mon Sep 17 00:00:00 2001 From: Korina Cordero Date: Fri, 30 Aug 2019 02:12:01 +0000 Subject: [PATCH] Add access rights for setting privacy policy. Add privacy policy field to Warranty, along with setter and getter. #261 --- config/api_acl.yaml | 2 ++ src/Entity/Warranty.php | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/config/api_acl.yaml b/config/api_acl.yaml index b677f99d..c3834bf9 100644 --- a/config/api_acl.yaml +++ b/config/api_acl.yaml @@ -18,6 +18,8 @@ access_keys: label: Cancel - id: warranty.delete label: Delete + - id: warranty.set.privacypolicy + label: Set Privacy Policy - id: batterybrand label: Battery Brand Access acls: diff --git a/src/Entity/Warranty.php b/src/Entity/Warranty.php index 1cfa242c..605d81ce 100644 --- a/src/Entity/Warranty.php +++ b/src/Entity/Warranty.php @@ -127,6 +127,13 @@ class Warranty */ protected $flag_activated; + // privacy policy + /** + * @ORM\ManyToOne(targetEntity="PrivacyPolicy", inversedBy="warranties") + * @ORM\JoinColumn(name="warranty_privacy_policy", referencedColumnName="id", nullable=true) + */ + protected $privacy_policy; + public function __construct() { $this->date_create = new DateTime(); @@ -366,4 +373,24 @@ class Warranty { return $this->flag_activated; } + + public function hasPrivacyPolicy() + { + if ($this->privacy_policy == null) + return false; + + return true; + } + + public function setPrivacyPolicy($privacy_policy) + { + $this->privacy_policy = $privacy_policy; + return $this; + } + + public function getPrivacyPolicy() + { + return $this->privacy_policy; + } + }