getSingleById($id); if (is_null($data)) { self::notFound(static::getResourceName() . " not found"); } return $data; } /** * @param $id int * @return true */ public static function deleteById($id) { $res = static::getDataAccess()->deleteSingleById($id); if (!$res) { self::notFound(static::getResourceName() . " not found"); } return true; } /** * @return LuDataAccess */ protected static function getDataAccess() { return null; } public static function getResourceName() { $match = []; preg_match('/([^\\\\]*)Business$/', get_called_class(), $match); return $match[1]; } }