Beispiel #1
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $channelsCollection
 */
// This is an Immediately Invoked Function in php.  The return value of the
// anonymous function will be returned to any file that "includes" it.
// e.g. $collection = include('channels.php');
return call_user_func(function () {
    $channelsCollection = new \Phalcon\Mvc\Micro\Collection();
    $channelsCollection->setPrefix('/' . $this->di->getConfig()->application->version . '/channels')->setHandler('\\App\\Modules\\Backend\\Controllers\\ChannelsController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $channelsCollection->options('/', 'optionsBase');
    $channelsCollection->options('/{id}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /channels/
    // Second paramter is the function name of the Controller.
    $channelsCollection->get('/', 'get');
    // This is exactly the same execution as GET, but the Response has no body.
    $channelsCollection->head('/', 'get');
    $channelsCollection->post('/search', 'search');
    $channelsCollection->post('/search/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'searchOne');
    // $id will be passed as a parameter to the Controller's specified function
    $channelsCollection->get('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'getOne');
    $channelsCollection->head('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'getOne');
    $channelsCollection->post('/', 'post');
    $channelsCollection->delete('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'delete');
    $channelsCollection->put('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'put');
    return $channelsCollection;
});
/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $exampleCollection
 */
// This is an Immeidately Invoked Function in php.  The return value of the
// anonymous function will be returned to any file that "includes" it.
// e.g. $collection = include('example.php');
return call_user_func(function () {
    $collection = new \Phalcon\Mvc\Micro\Collection();
    $collection->setPrefix('/api/wordType')->setHandler('\\Base\\Controllers\\Dictionary\\WordTypeController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $collection->options('/', 'optionsBase');
    $collection->options('/{id}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /example/
    // Second paramter is the function name of the Controller.
    $collection->get('/', 'get');
    // This is exactly the same execution as GET, but the Response has no body.
    $collection->head('/', 'get');
    // $id will be passed as a parameter to the Controller's specified function
    $collection->get('/{id:[0-9]+}', 'getOne');
    $collection->head('/{id:[0-9]+}', 'getOne');
    $collection->post('/create', 'create');
    $collection->post('/search', 'search');
    $collection->post('/update', 'update');
    $collection->delete('/{id:[0-9]+}', 'delete');
    $collection->put('/{id:[0-9]+}', 'put');
    $collection->patch('/{id:[0-9]+}', 'patch');
    return $collection;
});
Beispiel #3
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 *
 * @link http://docs.phalconphp.com/en/latest/api/Phalcon_Mvc_Micro_Collection.html
 */
return call_user_func(function () {
    $testCollection = new \Phalcon\Mvc\Micro\Collection();
    $testCollection->setPrefix('/' . VERSION . '/posts')->setHandler('Phanbook\\Controllers\\PostsController')->setLazy(true);
    // First paramter is the route, which with the collection prefix here would be GET /example/
    // Second paramter is the function name of the Controller.
    $testCollection->get('/', 'index');
    // This is exactly the same execution as GET, but the Response has no body.
    $testCollection->head('/', 'index');
    // $id will be passed as a parameter to the Controller's specified function
    $testCollection->get('/{id:[0-9]+}', 'getOne');
    $testCollection->head('/{id:[0-9]+}', 'getOne');
    $testCollection->post('/', 'post');
    $testCollection->delete('/{id:[0-9]+}', 'delete');
    $testCollection->put('/{id:[0-9]+}', 'put');
    $testCollection->patch('/{id:[0-9]+}', 'patch');
    return $testCollection;
});
Beispiel #4
0
<?php

/**
 * Standard routes for resource
 * Refer to routes/collections/example.php for further details
 */
return call_user_func(function () {
    $routes = new \Phalcon\Mvc\Micro\Collection();
    // VERSION NUMBER SHOULD BE FIRST URL PARAMETER, ALWAYS
    // setHandler MUST be a string in order to support lazy loading
    $routes->setPrefix('/v1/events')->setHandler('\\PhalconRest\\Controllers\\EventController')->setLazy(true);
    $routes->options('/', 'optionsBase');
    $routes->options('/{id}', 'optionsOne');
    $routes->get('/', 'get');
    $routes->head('/', 'get');
    $routes->post('/', 'post');
    $routes->get('/{id:[0-9]+}', 'getOne');
    $routes->head('/{id:[0-9]+}', 'getOne');
    $routes->delete('/{id:[0-9]+}', 'delete');
    $routes->put('/{id:[0-9]+}', 'put');
    $routes->patch('/{id:[0-9]+}', 'patch');
    return $routes;
});
Beispiel #5
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $autocompleteCollection
 */
// This is an Immeidately Invoked Function in php.  The return value of the
// anonymous function will be returned to any file that "includes" it.
// e.g. $collection = include('autocomplete.php');
return call_user_func(function () {
    $userCollection = new \Phalcon\Mvc\Micro\Collection();
    $userCollection->setPrefix('/v1/user')->setHandler('\\Api\\Controllers\\UserController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $userCollection->options('/', 'optionsBase');
    $userCollection->options('/{id,email,images}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /autocomplete/
    // Second paramter is the function name of the Controller.
    $userCollection->get('/', 'get');
    $userCollection->post('/', 'post');
    $userCollection->put('/{id:[a-zA-Z0-9_-]+}', 'put');
    // This is exactly the same execution as GET, but the Response has no body.
    $userCollection->head('/', 'get');
    return $userCollection;
});
/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $productsOptionsCollection
 */
// This is an Immediately Invoked Function in php.  The return value of the
// anonymous function will be returned to any file that "includes" it.
// e.g. $collection = include('products_options.php');
return call_user_func(function () {
    $productsOptionsCollection = new \Phalcon\Mvc\Micro\Collection();
    $productsOptionsCollection->setPrefix('/' . $this->di->getConfig()->application->version . '/products_options')->setHandler('\\App\\Modules\\Backend\\Controllers\\ProductsOptionsController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $productsOptionsCollection->options('/', 'optionsBase');
    $productsOptionsCollection->options('/{id}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /products_options/
    // Second paramter is the function name of the Controller.
    $productsOptionsCollection->get('/', 'get');
    // This is exactly the same execution as GET, but the Response has no body.
    $productsOptionsCollection->head('/', 'get');
    // $id will be passed as a parameter to the Controller's specified function
    $productsOptionsCollection->get('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'getOne');
    $productsOptionsCollection->head('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'getOne');
    $productsOptionsCollection->post('/', 'post');
    $productsOptionsCollection->post('/search', 'search');
    $productsOptionsCollection->post('/search/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'searchOne');
    $productsOptionsCollection->delete('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'delete');
    $productsOptionsCollection->put('/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'put');
    $productsOptionsCollection->put('/upload/{id:' . $this->di->getConfig()->application->idRegExp . '+}', 'upload');
    $productsOptionsCollection->put('/import', 'bulkImport');
    return $productsOptionsCollection;
});
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $autocompleteCollection
 */
return call_user_func(function () {
    $collection = new \Phalcon\Mvc\Micro\Collection();
    $collection->setPrefix('/v1/registerPersonal')->setHandler('\\Api\\Controllers\\RegisterPersonalController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $collection->options('/', 'optionsBase');
    //    $collection->options('/{access_token}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /autocomplete/
    // Second paramter is the function name of the Controller.
    $collection->get('/', 'get', 'registerPersonal-authbasic');
    //    $collection->get('/{aacess}', 'get', 'registerPersonal-authbasic');
    $collection->post('/', 'post');
    $collection->put('/', 'put');
    // This is exactly the same execution as GET, but the Response has no body.
    $collection->head('/', 'get');
    return $collection;
});
Beispiel #8
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $exampleCollection
 */
// This is an Immeidately Invoked Function in php.  The return value of the
// anonymous function will be returned to any file that "includes" it.
// e.g. $collection = include('example.php');
return call_user_func(function () {
    $exampleCollection = new \Phalcon\Mvc\Micro\Collection();
    $exampleCollection->setPrefix('/v1/example')->setHandler('\\PhalconRest\\Controllers\\ExampleController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $exampleCollection->options('/', 'optionsBase');
    $exampleCollection->options('/{id}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /example/
    // Second paramter is the function name of the Controller.
    $exampleCollection->get('/', 'get');
    // This is exactly the same execution as GET, but the Response has no body.
    $exampleCollection->head('/', 'get');
    // $id will be passed as a parameter to the Controller's specified function
    $exampleCollection->get('/{id:[0-9]+}', 'getOne');
    $exampleCollection->head('/{id:[0-9]+}', 'getOne');
    $exampleCollection->post('/', 'post');
    $exampleCollection->delete('/{id:[0-9]+}', 'delete');
    $exampleCollection->put('/{id:[0-9]+}', 'put');
    $exampleCollection->patch('/{id:[0-9]+}', 'patch');
    return $exampleCollection;
});
Beispiel #9
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $propertiesCollection
 */
// This is an Immediately Invoked Function in php.  The return value of the
// anonymous function will be returned to any file that "includes" it.
// e.g. $propertiesCollection = include('properties.php');
return call_user_func(function () {
    $propertiesCollection = new \Phalcon\Mvc\Micro\Collection();
    $propertiesCollection->setPrefix('/' . $this->di->getConfig()->application->version . '/properties')->setHandler('\\App\\Modules\\Backend\\Controllers\\PropertiesController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $propertiesCollection->options('/', 'optionsBase');
    $propertiesCollection->options('/{title}', 'optionsOne');
    // $title will be passed as a parameter to the Controller's specified function
    $propertiesCollection->get('/{title:[a-zA-Z]+}', 'getOne');
    $propertiesCollection->head('/{title:[a-zA-Z]+}', 'getOne');
    return $propertiesCollection;
});
Beispiel #10
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $autocompleteCollection
 */
return call_user_func(function () {
    $collection = new \Phalcon\Mvc\Micro\Collection();
    $collection->setPrefix('/v1/register')->setHandler('\\Api\\Controllers\\RegisterController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $collection->options('/', 'optionsBase');
    //    $collection->options('/{access_token}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /autocomplete/
    // Second paramter is the function name of the Controller.
    $collection->get('/', 'get', 'register-authbasic');
    $collection->get('/{aacess}', 'get', 'register-authbasic');
    $collection->post('/', 'post', 'register-post-authbasic');
    $collection->put('/', 'put', 'register-put--authbasic');
    // This is exactly the same execution as GET, but the Response has no body.
    $collection->head('/', 'get', 'register-head-authbasic');
    return $collection;
});
Beispiel #11
0
<?php

/**
 * Collections let us define groups of routes that will all use the same controller.
 * We can also set the handler to be lazy loaded.  Collections can share a common prefix.
 * @var $autocompleteCollection
 */
return call_user_func(function () {
    $loginCollection = new \Phalcon\Mvc\Micro\Collection();
    $loginCollection->setPrefix('/v1/login')->setHandler('\\Api\\Controllers\\LoginController')->setLazy(true);
    // Set Access-Control-Allow headers.
    $loginCollection->options('/', 'optionsBase');
    //    $loginCollection->options('/{access_token}', 'optionsOne');
    // First paramter is the route, which with the collection prefix here would be GET /autocomplete/
    // Second paramter is the function name of the Controller.
    $loginCollection->get('/', 'get', 'login-allow');
    $loginCollection->get('/me', 'me', 'login-me-allow');
    $loginCollection->get('/out', 'out', 'login-out-allow');
    $loginCollection->post('/', 'post', 'login-post--allow');
    // This is exactly the same execution as GET, but the Response has no body.
    $loginCollection->head('/', 'get', 'login-head-allow');
    return $loginCollection;
});