diff options
author | Max Kamashev <kamashev@gollard.ru> | 2015-09-24 12:06:02 +0300 |
---|---|---|
committer | Max Kamashev <kamashev@gollard.ru> | 2015-09-24 12:06:02 +0300 |
commit | 5b2e49d2945ce2c1daaf4dd78746a910eab9c9c8 (patch) | |
tree | bc813e6a203d88031fbf5293d40f525d987ccc31 /app | |
parent | aeb79f7de5c4c8b4008a21c2cdf952236f51aa4c (diff) |
refs #1245 - Subtask - Added option to events to avoid recursive calls
Diffstat (limited to 'app')
-rw-r--r-- | app/Model/Subtask.php | 5 | ||||
-rw-r--r-- | app/Model/SubtaskTimeTracking.php | 2 |
2 files changed, 4 insertions, 3 deletions
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)); diff --git a/app/Model/SubtaskTimeTracking.php b/app/Model/SubtaskTimeTracking.php index d65f2f75..7381060e 100644 --- a/app/Model/SubtaskTimeTracking.php +++ b/app/Model/SubtaskTimeTracking.php @@ -345,7 +345,7 @@ class SubtaskTimeTracking extends Base 'id' => $subtask['id'], 'time_spent' => $subtask['time_spent'] + $time_spent, 'task_id' => $subtask['task_id'], - )); + ), array('quietly' => true)); } /** |