public function __construct() { parent::__construct(); $this->setShared(Services::REQUEST, new \PhalconRest\Http\Request()); $this->setShared(Services::RESPONSE, new \PhalconRest\Http\Response()); $this->setShared(Services::AUTH_MANAGER, new \PhalconRest\Auth\Manager()); $this->setShared(Services::FRACTAL_MANAGER, function () { $className = '\\League\\Fractal\\Manager'; if (!class_exists($className)) { throw new Exception(ErrorCodes::GEN_SYSTEM, '\\League\\Fractal\\Manager was requested, but class could not be found'); } return new $className(); }); $this->setShared(Services::TOKEN_PARSER, function () { return new \PhalconRest\Auth\TokenParser\JWT('this_should_be_changed'); }); $this->setShared(Services::API_SERVICE, function () { return new \PhalconRest\Api\Service(); }); $this->setShared(Services::QUERY, function () { return new \PhalconRest\Data\Query(); }); $this->setShared(Services::PHQL_QUERY_PARSER, function () { return new \PhalconRest\Data\Query\Parser\Phql(); }); $this->setShared(Services::URL_QUERY_PARSER, function () { return new \PhalconRest\Data\Query\Parser\Url(); }); }
public function __construct(array $entireAppConfig) { parent::__construct(); $this->set('config', new Config($entireAppConfig), true); $this->setEventsManager(); $this->set('dispatcher', new Dispatcher($this), true); $this->set('view', new View()); }
/** * Phalcon\Di\FactoryDefault constructor */ public function __construct(\swoole_http_request $swooleRequest, \swoole_http_response $swooleResponse) { parent::__construct(); $request = new Request(); $response = new Response(); $request->setSwooleRequest($swooleRequest); $response->setSwooleResponse($swooleResponse); $this->setShared('request', $request); $this->setShared('response', $response); $this->_services['cookies'] = new Service('cookies', Cookies::class, true); $this->_services['session'] = new Service('session', SessionAdapter::class, true); }
/** * Construct all of the dependencies for the API */ public function __construct() { parent::__construct(); $this->setShared('request', function () { return new PhrestRequest(); }); $this->setShared('oauth2', function () { return false; }); $this->setShared('router', function () { return new Router(); }); }
/** * Application constructor. * @param null $basePath */ public function __construct($basePath = null) { // INIT Phalcon's DI parent::__construct(); // $this->registerBaseServices(); // $this->registerCoreServices(); if ($basePath) { $this->setBasePath($basePath); } $this->boot(); $this->init(); }
public function __construct($config, $paths, $module) { parent::__construct(); $this->config = $config; $this->paths = $paths; $this->module = $module; $class = new ReflectionClass($this); $methods = $class->getMethods(ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED); foreach ($methods as $method) { $methodName = $method->getName(); if (static::SHARED_PREFIX == substr($methodName, 0, 8)) { $sharedName = lcfirst(substr($methodName, static::SHARED_PREFIX_LENGTH)); $this->setShared($sharedName, $method->getClosure($this)); } } }
/** * \Phalcon\DI\FactoryDefault\CLI constructor */ public function __construct() { //@note It might be better if CLI directly extends DI, //since everything new from FactoryDefault gets overwritten parent::__construct(); $services = array(); /* Routing */ $services['router'] = new Service('router', 'Phalcon\\CLI\\Router'); $services['dispatcher'] = new Service('dispatcher', 'Phalcon\\CLI\\Dispatcher'); /* ORM */ $services['modelsManager'] = new Service('modelsManager', 'Phalcon\\Mvc\\Model\\Manager'); $services['modelsMetadata'] = new Service('modelsMetadata', 'Phalcon\\Mvc\\Model\\Metadata\\Memory'); /* Filter/Escaper */ $services['filter'] = new Service('filter', 'Phalcon\\Filter', true); $services['escaper'] = new Service('escaper', 'Phalcon\\Escaper', true); /* Other */ $services['annotations'] = new Service('annotations', 'Phalcon\\Annotations\\Adapter\\Memory', true); $services['security'] = new Service('security', 'Phalcon\\Security', true); /* Managers */ $services['eventsManager'] = new Service('eventsManager', 'Phalcon\\Events\\Manager', true); $services['transactionManager'] = new Service('transactionManager', 'Phalcon\\Mvc\\Model\\Transaction\\Manager'); //Update array $this->_services = $services; }
public function __construct() { parent::__construct(); }