|
@@ -40,8 +40,11 @@ abstract class LuBusiness {
|
40
|
40
|
* @param string $reason
|
41
|
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
|
48
|
throw new LuBusinessException($reason, 404);
|
46
|
49
|
}
|
47
|
50
|
|
|
@@ -70,7 +73,7 @@ abstract class LuBusiness {
|
70
|
73
|
{
|
71
|
74
|
$data = static::getDataAccess()->getSingleById($id);
|
72
|
75
|
if (is_null($data)) {
|
73
|
|
- self::notFound(static::getResourceName() . " not found");
|
|
76
|
+ self::notFound();
|
74
|
77
|
}
|
75
|
78
|
return $data;
|
76
|
79
|
}
|
|
@@ -103,7 +106,7 @@ abstract class LuBusiness {
|
103
|
106
|
*/
|
104
|
107
|
public static function editSingleById($id, $dbo)
|
105
|
108
|
{
|
106
|
|
- static::getSingleById($id);
|
|
109
|
+ static::checkIdExists($id);
|
107
|
110
|
static::getDataAccess()->editSingleById($dbo, $id);
|
108
|
111
|
return static::getSingleById($id);
|
109
|
112
|
}
|