bluzphp /
skeleton
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Public REST for pages |
||
| 4 | * |
||
| 5 | * @author Anton Shevchuk |
||
| 6 | * @created 30.10.12 09:29 |
||
| 7 | */ |
||
| 8 | |||
| 9 | namespace Application; |
||
| 10 | |||
| 11 | use Application\Pages; |
||
| 12 | use Bluz\Controller\Controller; |
||
|
0 ignored issues
–
show
|
|||
| 13 | use Bluz\Controller\Mapper\Rest; |
||
|
0 ignored issues
–
show
The type
Bluz\Controller\Mapper\Rest was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 14 | |||
| 15 | /** |
||
| 16 | * Get all pages or just one by ID |
||
| 17 | * For everyone |
||
| 18 | * |
||
| 19 | * @OA\Head( |
||
| 20 | * path="/api/pages/{pageId}", |
||
| 21 | * tags={"pages"}, |
||
| 22 | * operationId="getPageById", |
||
| 23 | * summary="Find page by ID", |
||
| 24 | * @OA\Parameter( |
||
| 25 | * name="pageId", |
||
| 26 | * in="path", |
||
| 27 | * required=true, |
||
| 28 | * description="ID of page that needs to be fetched", |
||
| 29 | * @OA\Schema(type="integer") |
||
| 30 | * ), |
||
| 31 | * @OA\Response(response=200, description="Given page found"), |
||
| 32 | * @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=404, description="Page not found") |
||
| 33 | * ) |
||
| 34 | * |
||
| 35 | * @OA\Get( |
||
| 36 | * path="/api/pages/{pageId}", |
||
| 37 | * tags={"pages"}, |
||
| 38 | * operationId="getPageById", |
||
| 39 | * summary="Find page by ID", |
||
| 40 | * @OA\Parameter( |
||
| 41 | * name="pageId", |
||
| 42 | * in="path", |
||
| 43 | * required=true, |
||
| 44 | * description="ID of page that needs to be fetched", |
||
| 45 | * @OA\Schema(type="integer") |
||
| 46 | * ), |
||
| 47 | * @OA\Response( |
||
| 48 | * @OA\JsonContent(ref="#/components/schemas/page"), |
||
| 49 | * response=200, |
||
| 50 | * description="Given page found" |
||
| 51 | * ), |
||
| 52 | * @OA\Response(@OA\JsonContent(ref="#/components/schemas/error"), response=404, description="Page not found") |
||
| 53 | * ) |
||
| 54 | * |
||
| 55 | * @OA\Get( |
||
| 56 | * path="/api/pages/", |
||
| 57 | * tags={"pages"}, |
||
| 58 | * method="GET", |
||
| 59 | * operationId="getPageCollection", |
||
| 60 | * summary="Collection of items", |
||
| 61 | * @OA\Parameter(ref="#/components/parameters/offset_in_query"), |
||
| 62 | * @OA\Parameter(ref="#/components/parameters/limit_in_query"), |
||
| 63 | * @OA\Response( |
||
| 64 | * @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/page")), |
||
| 65 | * response=200, |
||
| 66 | * description="Collection" |
||
| 67 | * ), |
||
| 68 | * @OA\Response( |
||
| 69 | * @OA\JsonContent(type="array", @OA\Items(ref="#/components/schemas/page")), |
||
| 70 | * response=206, |
||
| 71 | * description="Collection (partial)" |
||
| 72 | * ) |
||
| 73 | * ) |
||
| 74 | * |
||
| 75 | * @accept JSON |
||
| 76 | * @return mixed |
||
| 77 | */ |
||
| 78 | return function () { |
||
| 79 | /** |
||
| 80 | * @var Controller $this |
||
| 81 | */ |
||
| 82 | $rest = new Rest(Pages\Crud::getInstance()); |
||
| 83 | |||
| 84 | $rest |
||
| 85 | ->head('system', 'rest/head') |
||
| 86 | ->fields( |
||
| 87 | [ |
||
| 88 | 'id', |
||
| 89 | 'title', |
||
| 90 | 'content', |
||
| 91 | 'keywords', |
||
| 92 | 'description' |
||
| 93 | ] |
||
| 94 | ); |
||
| 95 | $rest |
||
| 96 | ->get('system', 'rest/get') |
||
| 97 | ->fields( |
||
| 98 | [ |
||
| 99 | 'id', |
||
| 100 | 'title', |
||
| 101 | 'content', |
||
| 102 | 'keywords', |
||
| 103 | 'description' |
||
| 104 | ] |
||
| 105 | ); |
||
| 106 | 40 | ||
| 107 | return $rest->run(); |
||
| 108 | }; |
||
| 109 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths