From dd693d59fcbe694b4933e3ec0673588c805d9d9c Mon Sep 17 00:00:00 2001 From: Eldad Fux Date: Mon, 10 Feb 2020 18:15:18 +0200 Subject: [PATCH] Added method to remove attribute --- src/Database/Document.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/Database/Document.php b/src/Database/Document.php index 1f7b5ff4a..76e028c44 100644 --- a/src/Database/Document.php +++ b/src/Database/Document.php @@ -121,6 +121,26 @@ class Document extends ArrayObject return $this; } + /** + * Remove Attribute. + * + * Method for removing a specific field attribute + * + * @param string $key + * @param mixed $value + * @param string $type + * + * @return mixed + */ + public function removeAttribute($key) + { + if(isset($this[$key])) { + unset($this[$key]); + } + + return $this; + } + /** * Search. *