[icinga-checkins] icinga.org: icingaweb2/feature/announce-banner-11198: IniRepository: Don' t fail if there is no trigger to be found

git at icinga.org git at icinga.org
Wed Nov 2 17:52:34 CET 2016


Module: icingaweb2
Branch: feature/announce-banner-11198
Commit: 4a791e6204d1ae56a894e8dd6a1a88541dca0234
URL:    https://git.icinga.org/?p=icingaweb2.git;a=commit;h=4a791e6204d1ae56a894e8dd6a1a88541dca0234

Author: Johannes Meyer <johannes.meyer at netways.de>
Date:   Wed Nov  2 13:25:37 2016 +0100

IniRepository: Don't fail if there is no trigger to be found


---

 library/Icinga/Repository/IniRepository.php |   12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/library/Icinga/Repository/IniRepository.php b/library/Icinga/Repository/IniRepository.php
index b292dc2..7413971 100644
--- a/library/Icinga/Repository/IniRepository.php
+++ b/library/Icinga/Repository/IniRepository.php
@@ -152,8 +152,6 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
      * @param   string  $event  The name of the event type
      *
      * @return  string
-     *
-     * @throws  ProgrammingError    In case the table is registered as having triggers but not any trigger is found
      */
     protected function getTrigger($table, $event)
     {
@@ -162,15 +160,9 @@ abstract class IniRepository extends Repository implements Extensible, Updatable
         }
 
         $identifier = join('', array_map('ucfirst', explode('_', $table)));
-        if (! method_exists($this, $event . $identifier)) {
-            throw new ProgrammingError(
-                'Cannot find any trigger for table "%s". Add a trigger or remove the table from %s::$triggers',
-                $table,
-                get_class($this)
-            );
+        if (method_exists($this, $event . $identifier)) {
+            return $event . $identifier;
         }
-
-        return $event . $identifier;
     }
 
     /**



More information about the icinga-checkins mailing list