Commit b660745bc032093904d4d254a9e2dbd2ee71fc86
1 parent
c9087298
git bug
Showing
2 changed files
with
67 additions
and
0 deletions
Show diff stats
app/library/App/Controllers/AllPositionController.php
0 → 100644
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: Alex Savenko | ||
| 5 | + * Date: 22.02.2017 | ||
| 6 | + * Time: 20:18 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +namespace App\Controllers; | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | +use PhalconRest\Mvc\Controllers\CrudResourceController; | ||
| 14 | +use xf3\AllPositions; | ||
| 15 | + | ||
| 16 | +class AllPositionController extends CrudResourceController | ||
| 17 | +{ | ||
| 18 | + const API_KEY = '150bb253651622507341cd7845f5b9d2'; | ||
| 19 | + | ||
| 20 | + public function testAction() { | ||
| 21 | + | ||
| 22 | + $APObj = new AllPositions(self::API_KEY); | ||
| 23 | + | ||
| 24 | + $project_info = $APObj->get_project(418068); | ||
| 25 | + | ||
| 26 | + return $project_info; | ||
| 27 | + | ||
| 28 | + } | ||
| 29 | + | ||
| 30 | +} | ||
| 0 | \ No newline at end of file | 31 | \ No newline at end of file |
| 1 | +<?php | ||
| 2 | +/** | ||
| 3 | + * Created by PhpStorm. | ||
| 4 | + * User: Alex Savenko | ||
| 5 | + * Date: 22.02.2017 | ||
| 6 | + * Time: 20:29 | ||
| 7 | + */ | ||
| 8 | + | ||
| 9 | +namespace App\Resources; | ||
| 10 | + | ||
| 11 | + | ||
| 12 | +use App\Controllers\AllPositionController; | ||
| 13 | +use PhalconRest\Api\ApiResource; | ||
| 14 | + | ||
| 15 | +class AllPositionResource extends ApiResource | ||
| 16 | +{ | ||
| 17 | + | ||
| 18 | + public function initialize() { | ||
| 19 | + | ||
| 20 | + $this | ||
| 21 | + ->name('All Position') | ||
| 22 | + ->expectsJsonData() | ||
| 23 | + //->transformer(ModelTransformer::class) | ||
| 24 | + ->itemKey('ap') | ||
| 25 | + ->collectionKey('ap') | ||
| 26 | + ->deny(AclRoles::UNAUTHORIZED) | ||
| 27 | + ->handler(AllPositionController::class) | ||
| 28 | + | ||
| 29 | + ->endpoint(ApiEndpoint::get('', 'testAction') | ||
| 30 | + ->allow(AclRoles::USER) | ||
| 31 | + ->description('Returns data from AllPosition Api.') | ||
| 32 | + ) | ||
| 33 | + ; | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +} | ||
| 0 | \ No newline at end of file | 38 | \ No newline at end of file |