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