From 5b2e49d2945ce2c1daaf4dd78746a910eab9c9c8 Mon Sep 17 00:00:00 2001 From: Max Kamashev Date: Thu, 24 Sep 2015 12:06:02 +0300 Subject: refs #1245 - Subtask - Added option to events to avoid recursive calls --- app/Model/Subtask.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'app/Model/Subtask.php') diff --git a/app/Model/Subtask.php b/app/Model/Subtask.php index 95e60bce..a3911cf7 100644 --- a/app/Model/Subtask.php +++ b/app/Model/Subtask.php @@ -234,15 +234,16 @@ class Subtask extends Base * * @access public * @param array $values Form values + * @param array $options Additional options. If passed [quietly => true] - will not be called an event * @return bool */ - public function update(array $values) + public function update(array $values, array $options = null) { $this->prepare($values); $subtask = $this->getById($values['id']); $result = $this->db->table(self::TABLE)->eq('id', $values['id'])->save($values); - if ($result) { + if ($result && isset($options['quietly']) && $options['quietly']) { $event = $subtask; $event['changes'] = array_diff_assoc($values, $subtask); $this->container['dispatcher']->dispatch(self::EVENT_UPDATE, new SubtaskEvent($event)); -- cgit v1.2.3