Browse Source

refrator

develop
Robin Thoni 8 years ago
parent
commit
f3b6635e4f
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      src/Utils/Business/LuBusiness.php

+ 6
- 3
src/Utils/Business/LuBusiness.php View File

40
      * @param string $reason
40
      * @param string $reason
41
      * @throws LuBusinessException
41
      * @throws LuBusinessException
42
      */
42
      */
43
-    public static function notFound($reason = 'Resource not found')
43
+    public static function notFound($reason = null)
44
     {
44
     {
45
+        if (is_null($reason)) {
46
+            $reason = static::getResourceName() . " not found";
47
+        }
45
         throw new LuBusinessException($reason, 404);
48
         throw new LuBusinessException($reason, 404);
46
     }
49
     }
47
 
50
 
70
     {
73
     {
71
         $data = static::getDataAccess()->getSingleById($id);
74
         $data = static::getDataAccess()->getSingleById($id);
72
         if (is_null($data)) {
75
         if (is_null($data)) {
73
-            self::notFound(static::getResourceName() . " not found");
76
+            self::notFound();
74
         }
77
         }
75
         return $data;
78
         return $data;
76
     }
79
     }
103
      */
106
      */
104
     public static function editSingleById($id, $dbo)
107
     public static function editSingleById($id, $dbo)
105
     {
108
     {
106
-        static::getSingleById($id);
109
+        static::checkIdExists($id);
107
         static::getDataAccess()->editSingleById($dbo, $id);
110
         static::getDataAccess()->editSingleById($dbo, $id);
108
         return static::getSingleById($id);
111
         return static::getSingleById($id);
109
     }
112
     }

Loading…
Cancel
Save