public function define(Container $di) { /** * Services */ $di->set('aura/html:escaper', $di->lazyNew('Aura\\Html\\Escaper')); $di->set('aura/html:helper', $di->lazyNew('Aura\\Html\\HelperLocator')); /** * Aura\Html\Escaper */ $di->params['Aura\\Html\\Escaper'] = array('html' => $di->lazyNew('Aura\\Html\\Escaper\\HtmlEscaper'), 'attr' => $di->lazyNew('Aura\\Html\\Escaper\\AttrEscaper'), 'css' => $di->lazyNew('Aura\\Html\\Escaper\\CssEscaper'), 'js' => $di->lazyNew('Aura\\Html\\Escaper\\JsEscaper')); /** * Aura\Html\Escaper\AttrEscaper */ $di->params['Aura\\Html\\Escaper\\AttrEscaper'] = array('html' => $di->lazyNew('Aura\\Html\\Escaper\\HtmlEscaper')); /** * Aura\Html\HelperLocator */ $di->params['Aura\\Html\\HelperLocator']['map'] = array('a' => $di->lazyNew('Aura\\Html\\Helper\\Anchor'), 'anchor' => $di->lazyNew('Aura\\Html\\Helper\\Anchor'), 'base' => $di->lazyNew('Aura\\Html\\Helper\\Base'), 'escape' => $di->lazyGet('aura/html:escaper'), 'form' => $di->lazyNew('Aura\\Html\\Helper\\Form'), 'img' => $di->lazyNew('Aura\\Html\\Helper\\Img'), 'image' => $di->lazyNew('Aura\\Html\\Helper\\Img'), 'input' => $di->lazyNew('Aura\\Html\\Helper\\Input'), 'label' => $di->lazyNew('Aura\\Html\\Helper\\Label'), 'links' => $di->lazyNew('Aura\\Html\\Helper\\Links'), 'metas' => $di->lazyNew('Aura\\Html\\Helper\\Metas'), 'ol' => $di->lazyNew('Aura\\Html\\Helper\\Ol'), 'scripts' => $di->lazyNew('Aura\\Html\\Helper\\Scripts'), 'scriptsFoot' => $di->lazyNew('Aura\\Html\\Helper\\Scripts'), 'styles' => $di->lazyNew('Aura\\Html\\Helper\\Styles'), 'tag' => $di->lazyNew('Aura\\Html\\Helper\\Tag'), 'title' => $di->lazyNew('Aura\\Html\\Helper\\Title'), 'ul' => $di->lazyNew('Aura\\Html\\Helper\\Ul')); /** * Aura\Html\Helper\AbstractHelper */ $di->params['Aura\\Html\\Helper\\AbstractHelper']['escaper'] = $di->lazyGet('aura/html:escaper'); /** * Aura\Html\Helper\Input */ $di->params['Aura\\Html\\Helper\\Input']['map'] = array('button' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'checkbox' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Checkbox'), 'color' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'date' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'datetime' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'datetime-local' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'email' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'file' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'hidden' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'image' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'month' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'number' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'password' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'radio' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Radio'), 'range' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'reset' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'search' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'select' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Select'), 'submit' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'tel' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'text' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'textarea' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Textarea'), 'time' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'url' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic'), 'week' => $di->lazyNew('Aura\\Html\\Helper\\Input\\Generic')); }
/** * Define Aura\View and Aura\Html factories and services * * @param Container $di DI Container * * @return void * * @access public * * @SuppressWarnings(PHPMD.ShortVariable) */ public function define(Container $di) { /** * Services */ $di->set('application/domain:postGateway', $di->lazyNew('Application\\Data\\Gateway\\PostSqlite')); /** * Aura.view */ // Aura\Html $di->set('aura/html:factory', $di->lazyNew(HelperLocatorFactory::class)); $di->set('aura/html:helpers', $di->lazyGetCall('aura/html:factory', 'newInstance')); // Aura\View $di->set('aura/view:factory', $di->lazyNew(ViewFactory::class)); $di->set('aura/view:view', $di->lazyGetCall('aura/view:factory', 'newInstance', $di->lazyGet('aura/html:helpers'))); // view files and paths from class $viewsconfig = new \Application\Config\AuraViews(); $views = $viewsconfig->getViews(); /** * Parameters */ // lazy load $di->params['Application\\Domain\\Aura']['payload'] = $di->lazyNew('Aura\\Payload\\Payload'); // binding variables to classes $di->params['Application\\Responder\\AuraViewStaticPage']['views'] = $views; // refactor or drop this $di->params['Application\\Responder\\AuraViewResponder']['views'] = $views; // domains $di->params['Application\\Domain\\Page']['postGateway'] = $di->lazyGet('application/domain:postGateway'); }
/** * @inheritDoc */ public function define(Container $di) { $di->set('event_dispatcher', $di->lazyNew(EventDispatcher::class)); $di->params[Application::class]['eventDispatcher'] = $di->lazyGet('event_dispatcher'); $di->params[Application::class]['contextFactory'] = $di->lazyNew(ContextFactory::class); $di->params[ContextFactory::class]['eventDispatcher'] = $di->lazyGet('event_dispatcher'); $di->params[ContextFactory::class]['optionDefinitionParser'] = $di->lazyNew(OptionDefinitionParser::class); $di->params[ContextFactory::class]['usageParserBuilder'] = $di->lazyNew(UsageParserBuilder::class); }
public function define(Container $di) { //$di->set('era:payload_factory', $di->lazyNew(\Aura\Payload\PayloadFactory::class)); //$di->params[\Era\Domain\Home\AppService\Home::class]['payload'] = $di->lazyGetCall('era:payload_factory', 'newInstance'); $di->params['Era\\Domain\\Home\\AppService\\Home']['payload'] = $di->lazyNew('Aura\\Payload\\Payload'); $di->set('era:twig', $di->lazyNew('Twig_Environment')); $di->set('era:twig-loader', $di->lazyNew('Twig_Loader_Filesystem')); $di->params['Era\\Http\\Responder\\TwigResponder']['twig'] = $di->lazyGet('era:twig'); $di->params['Twig_Environment']['loader'] = $di->lazyGet('era:twig-loader'); $di->params['Twig_Environment']['options'] = ['cache' => ERA_ROOT . '/cache/twig', 'auto_reload' => true]; $di->params['Twig_Loader_Filesystem']['paths'] = [ERA_ROOT . '/views']; }
protected function setView(Container $di, $templating, $basePath) { $di->setters['Puzzle\\Core\\View']['setRouter'] = $di->lazyGet("router"); $di->setters['Puzzle\\Core\\View']['setBaseUrl'] = $templating['baseUrl']; $di->setters['Puzzle\\Core\\View']['setSignalManager'] = $di->lazyGet('signal_manager'); $themePath = $basePath . "/app/Resources/views/" . $templating['active_theme'] . "/"; $adminThemePath = $basePath . "/app/Resources/views/" . $templating['admin_theme'] . "/"; $webPath = $basePath . "/web/"; $di->params['Puzzle\\Core\\View']['themePath'] = $themePath; $di->params['Puzzle\\Core\\View']['adminThemePath'] = $adminThemePath; $di->params['Puzzle\\Core\\View']['webPath'] = $webPath; $di->set("view", $di->lazyNew("Puzzle\\Core\\View")); }
public function define(Container $di) { $di->set('event_dispatcher', $di->lazyNew(EventDispatcher::class)); $di->params[Application::class]['eventDispatcher'] = $di->lazyGet('event_dispatcher'); $di->params[Application::class]['contextFactory'] = $di->lazyNew(ContextFactory::class); $di->params[Application::class]['plugins'] = $di->lazy(function () { $plugins = []; $plugins[] = new ContextualHelpPlugin(); $plugins[] = new VersionInfoPlugin(); return $plugins; }); $di->params[ContextFactory::class]['eventDispatcher'] = $di->lazyGet('event_dispatcher'); $di->params[ContextFactory::class]['optionDefinitionParser'] = $di->lazyNew(OptionDefinitionParser::class); $di->params[ContextFactory::class]['usageParserBuilder'] = $di->lazyNew(UsageParserBuilder::class); }
public function define(Container $di) { $di->set('aura/project-kernel:logger', $di->newInstance('Monolog\\Logger')); /* @var $ci \CI_Controller */ $ci =& get_instance(); // register built-in command classes foreach ($this->commands as $command) { $class = 'CLI\\Command\\' . $command; $di->params[$class] = ['context' => $di->lazyGet('aura/cli-kernel:context'), 'stdio' => $di->lazyGet('aura/cli-kernel:stdio'), 'ci' => $ci]; } $seeder_path = ROOTPATH . 'database/seeds/'; $di->setter['Kenjis\\CodeIgniter_Cli\\Command\\Seed']['setSeederPath'] = $seeder_path; $this->user_command_paths = [APPPATH . 'console/command/']; // register user command classes UserConfig::registerCommandClasses($di, $ci, $this->user_command_paths); }
public function define(Container $di) { /* why can't a trait be set? $u = User(); $m = new \Domain\Todo\Mapper; $t = new \Domain\Todo\TodoEntity; $p = new \Aura\Payload\Payload(); $di->params['Domain\Todo\ApplicationService\EditItem']['user'] = $u; $di->params['Domain\Todo\ApplicationService\EditItem']['mapper'] = $m; $di->params['Domain\Todo\ApplicationService\EditItem']['payload'] = $p; $di->params['Domain\Todo\ApplicationService\AddItem']['user'] = $u; $di->params['Domain\Todo\ApplicationService\AddItem']['mapper'] = $m; $di->params['Domain\Todo\ApplicationService\AddItem']['payload'] = $p; $di->params['Domain\Todo\ApplicationService\GetList']['user'] = $u; $di->params['Domain\Todo\ApplicationService\GetList']['mapper'] = $m; $di->params['Domain\Todo\ApplicationService\GetList']['payload'] = $p; $di->params['Domain\Todo\ApplicationService\DeleteItem']['user'] = $u; $di->params['Domain\Todo\ApplicationService\DeleteItem']['mapper'] = $m; $di->params['Domain\Todo\ApplicationService\DeleteItem']['payload'] = $p; */ $databaseHandle = \defaultTodoPdo(); $di->params['Aura\\Sql\\ExtendedPdo']['dsn'] = $databaseHandle; $di->set('aura/payload', $di->lazyNew('Aura\\Payload\\Payload')); $di->set('user', $di->lazyNew('Domain\\User\\User')); $di->types['User'] = $di->lazyGet('user'); $di->params['Aura\\Auth\\AuthFactory']['cookie'] = $_COOKIE; $di->params['Aura\\Auth\\Verifier\\PasswordVerifier']['algo'] = PASSWORD_DEFAULT; // should be optional }
public function define(Container $di) { $di->set('Aol\\Atc\\Dispatch', $di->lazyNew('Aol\\Atc\\Dispatch')); $di->set('Aol\\Atc\\ActionFactory', $di->lazyNew('Aol\\Atc\\ActionFactory')); $di->set('Aol\\Atc\\ActionFactoryInterface', $di->lazyGet('Aol\\Atc\\ActionFactory')); $di->set('Aol\\Atc\\Presenter', $di->lazyNew('Aol\\Atc\\Presenter')); $di->set('Aol\\Atc\\PresenterInterface', $di->lazyGet('Aol\\Atc\\Presenter')); $di->set('Aol\\Atc\\EventDispatcher', $di->lazyNew('Aol\\Atc\\EventDispatcher')); $di->set('Aol\\Atc\\EventHandlers\\DispatchErrorHandler', $di->lazyNew('Aol\\Atc\\EventHandlers\\DispatchErrorHandler')); $di->params['Aol\\Atc\\Dispatch'] = ['router' => $di->lazyGet('Aura\\Router\\Router'), 'web_factory' => $di->lazyGet('Aura\\Web\\WebFactory'), 'action_factory' => $di->lazyGet('Aol\\Atc\\ActionFactoryInterface'), 'presenter' => $di->lazyGet('Aol\\Atc\\PresenterInterface'), 'event_dispatcher' => $di->lazyGet('Aol\\Atc\\EventDispatcher'), 'exception_handler' => $di->lazyGet('Aol\\Atc\\EventHandlers\\DispatchErrorHandler')]; }
public function define(Container $di) { $di->set('blog/domain:postGateway', $di->lazyNew('Blog\\Data\\Gateway\\PostMemory')); // $di->set('blog/domain:postGateway', $di->lazyNew('Blog\Data\Gateway\PostSqlite')); // $di->set('dbh', $di->lazyNew('PDO')); if (!file_exists(__DIR__ . '/../../../data')) { mkdir(__DIR__ . '/../../../data'); } $dataDir = realpath(__DIR__ . '/../../../data'); $di->params['PDO']['dsn'] = 'sqlite:' . $dataDir . '/db.sqlite'; $di->params['PDO']['username'] = ''; $di->params['PDO']['passwd'] = ''; $di->params['PDO']['options'] = []; $di->params['Blog\\Data\\Gateway\\PostSqlite']['dbh'] = $di->lazyGet('dbh'); $di->params['Blog\\Delivery\\Responder\\Html']['viewDir'] = __DIR__ . '/../../../views'; $di->params['Blog\\Domain\\Interactor\\ListAllPosts']['postGateway'] = $di->lazyGet('blog/domain:postGateway'); $di->params['Blog\\Domain\\Interactor\\DisplaySinglePost']['postGateway'] = $di->lazyGet('blog/domain:postGateway'); $di->params['Blog\\Domain\\Interactor\\CreateNewPost']['postGateway'] = $di->lazyGet('blog/domain:postGateway'); }
public function define(Container $di) { /** * Services */ $di->set('aura/auth:auth', $di->lazyNew('Aura\\Auth\\Auth')); $di->set('aura/auth:login_service', $di->lazyNew('Aura\\Auth\\Service\\LoginService')); $di->set('aura/auth:logout_service', $di->lazyNew('Aura\\Auth\\Service\\LogoutService')); $di->set('aura/auth:resume_service', $di->lazyNew('Aura\\Auth\\Service\\ResumeService')); $di->set('aura/auth:session', $di->lazyNew('Aura\\Auth\\Session\\Session')); $di->set('aura/auth:adapter', $di->lazyNew('Aura\\Auth\\Adapter\\NullAdapter')); /** * Aura\Auth\Adapter\HtpasswdAdapter */ $di->params['Aura\\Auth\\Adapter\\HtpasswdAdapter'] = array('verifier' => $di->lazyNew('Aura\\Auth\\Verifier\\HtpasswdVerifier')); /** * Aura\Auth\Adapter\ImapAdapter */ $di->params['Aura\\Auth\\Adapter\\ImapAdapter'] = array('phpfunc' => $di->lazyNew('Aura\\Auth\\Phpfunc')); /** * Aura\Auth\Adapter\LdapAdapter */ $di->params['Aura\\Auth\\Adapter\\LdapAdapter'] = array('phpfunc' => $di->lazyNew('Aura\\Auth\\Phpfunc')); /** * Aura\Auth\Adapter\PdoAdapter */ $di->params['Aura\\Auth\\Adapter\\PdoAdapter'] = array('verifier' => $di->lazyNew('Aura\\Auth\\Verifier\\PasswordVerifier'), 'from' => 'users', 'cols' => array('username', 'password')); /** * Aura\Auth\Auth */ $di->params['Aura\\Auth\\Auth'] = array('segment' => $di->lazyNew('Aura\\Auth\\Session\\Segment')); /** * Aura\Auth\Service\LoginService */ $di->params['Aura\\Auth\\Service\\LoginService'] = array('adapter' => $di->lazyGet('aura/auth:adapter'), 'session' => $di->lazyGet('aura/auth:session')); /** * Aura\Auth\Service\LogoutService */ $di->params['Aura\\Auth\\Service\\LogoutService'] = array('adapter' => $di->lazyGet('aura/auth:adapter'), 'session' => $di->lazyGet('aura/auth:session')); /** * Aura\Auth\Service\ResumeService */ $di->params['Aura\\Auth\\Service\\ResumeService'] = array('adapter' => $di->lazyGet('aura/auth:adapter'), 'session' => $di->lazyGet('aura/auth:session'), 'timer' => $di->lazyNew('Aura\\Auth\\Session\\Timer'), 'logout_service' => $di->lazyGet('aura/auth:logout_service')); /** * Aura\Auth\Session\Timer */ $di->params['Aura\\Auth\\Session\\Timer'] = array('ini_gc_maxliftime' => ini_get('session.gc_maxlifetime'), 'ini_cookie_liftime' => ini_get('session.cookie_lifetime'), 'idle_ttl' => 1440, 'expire_ttl' => 14400); /** * Aura\Auth\Session\Session */ $di->params['Aura\\Auth\\Session\\Session'] = array('cookie' => $_COOKIE); /** * Aura\Auth\Verifier\PasswordVerifier */ $di->params['Aura\\Auth\\Verifier\\PasswordVerifier'] = array('algo' => 'NO_ALGO_SPECIFIED'); }
public function define(Container $di) { /** * Services */ $di->set('invoice/domain:mapper', $di->lazyNew('Invoice\\Persistence\\FilesystemMapper')); /** * Invoice Mapper */ $di->params['Invoice\\Persistence\\FilesystemMapper']['path'] = INVOICE_ROOT . '/res/invoices'; $di->params['Invoice\\Persistence\\FilesystemMapper']['yaml'] = $di->lazyNew('Symfony\\Component\\Yaml\\Parser'); $di->params['Invoice\\Persistence\\FilesystemMapper']['normalizer'] = $di->lazyNew('Invoice\\Domain\\Normalizer'); /** * ListAllInvoices */ $di->params['Invoice\\Domain\\Action\\ListAllInvoices']['mapper'] = $di->lazyGet('invoice/domain:mapper'); /** * ViewSingleInvoice */ $di->params['Invoice\\Domain\\Action\\ViewSingleInvoice']['mapper'] = $di->lazyGet('invoice/domain:mapper'); }
public function define(Container $di) { $di->set('http_middlewares', $di->lazyNew('asylgrp\\workbench\\Http\\Middleware\\MiddlewareQueue')); $di->set('http_emitter', $di->lazyNew('Zend\\Diactoros\\Response\\SapiEmitter')); $di->set('http_runner', $di->lazyNew('Relay\\Runner', ['queue' => $di->lazyGetCall('http_middlewares', 'asArray')])); $di->set('http_request', $di->lazy(['Zend\\Diactoros\\ServerRequestFactory', 'fromGlobals'])); $di->set('http_response', $di->lazyNew('Zend\\Diactoros\\Response')); $di->set('event_dispatcher', $di->lazyNew('Symfony\\Component\\EventDispatcher\\EventDispatcher')); $di->types['Symfony\\Component\\EventDispatcher\\EventDispatcherInterface'] = $di->lazyGet('event_dispatcher'); $di->set('contact_storage', $di->lazy(function () use($di) { return new \asylgrp\workbench\Storage\ContactStorage(new \asylgrp\workbench\Storage\Mapper(new \asylgrp\workbench\Storage\JsonFileHandle($di->get('settings')->read('db.contacts')), $di->newInstance('asylgrp\\workbench\\Storage\\Arrayizer\\ContactArrayizer'))); })); $di->types['asylgrp\\workbench\\Storage\\ContactStorage'] = $di->lazyGet('contact_storage'); $di->params['asylgrp\\workbench\\Storage\\ClaimStorage']['file'] = $di->lazyNew('asylgrp\\workbench\\Storage\\JsonFileHandle', [$di->lazyGetCall('settings', 'read', 'db.claims')]); $di->set('claim_storage', $di->lazyNew('asylgrp\\workbench\\Storage\\ClaimStorage')); $di->types['asylgrp\\workbench\\Storage\\ClaimStorage'] = $di->lazyGet('claim_storage'); $di->params['Aura\\Router\\RouterContainer']['basepath'] = $di->lazyGetCall('settings', 'read', 'api.base_path'); $di->set('router_container', $di->lazyNew('Aura\\Router\\RouterContainer')); $di->set('router_map', $di->lazyGetCall('router_container', 'getMap')); $di->set('router_matcher', $di->lazyGetCall('router_container', 'getMatcher')); $di->types['Aura\\Router\\Matcher'] = $di->lazyGet('router_matcher'); $di->set('router_generator', $di->lazyGetCall('router_container', 'getGenerator')); $di->types['Aura\\Router\\Generator'] = $di->lazyGet('router_generator'); }
/** * Defines configuration for the dependency injection container * * @param Container $di Aura dependency injection container */ public function define(Container $di) { $di->set('Aura\\Cli\\Context', $di->lazyNew('Aura\\Cli\\Context')); $di->set('Aura\\Cli\\Help', $di->lazyNew('Aura\\Cli\\Help')); // Typehinted dependency resolution for command classes $di->params['ShootProof\\Cli\\Command\\BaseCommand']['stdio'] = $di->lazyNew('Aura\\Cli\\Stdio'); $di->params['ShootProof\\Cli\\Command\\BaseCommand']['api'] = $di->get('ShootProofApi'); $di->params['ShootProof\\Cli\\Command\\BaseCommand']['logger'] = $di->get('Logger'); $di->types['Help'] = $di->lazyGet('Help'); // Map CLI keywords to command classes $di->set('push', $di->lazyNew('ShootProof\\Cli\\Command\\PushCommand')); $di->set('pull', $di->lazyNew('ShootProof\\Cli\\Command\\PullCommand')); $di->set('accesslevel', $di->lazyNew('ShootProof\\Cli\\Command\\AccesslevelCommand')); $di->set('brands', $di->lazyNew('ShootProof\\Cli\\Command\\BrandsCommand')); $di->set('help', $di->lazyNew('ShootProof\\Cli\\Command\\HelpCommand')); }
public function define(Container $di) { /** * Services */ $di->set('aura/session:session', $di->lazyNew('Aura\\Session\\Session')); /** * Aura\Session\CsrfTokenFactory */ $di->params['Aura\\Session\\CsrfTokenFactory']['randval'] = $di->lazyNew('Aura\\Session\\Randval'); /** * Aura\Session\Session */ $di->params['Aura\\Session\\Session'] = array('segment_factory' => $di->lazyNew('Aura\\Session\\SegmentFactory'), 'csrf_token_factory' => $di->lazyNew('Aura\\Session\\CsrfTokenFactory'), 'cookies' => $_COOKIE, 'phpfunc' => $di->lazyNew('Aura\\Session\\Phpfunc')); /** * Aura\Session\Randval */ $di->params['Aura\\Session\\Randval']['phpfunc'] = $di->lazyNew('Aura\\Session\\Phpfunc'); /** * Aura\Session\Segment */ $di->params['Aura\\Session\\Segment'] = array('session' => $di->lazyGet('aura/session:session')); }
public function define(Container $di) { $di->params['Aura\\View\\View']['helpers'] = $di->lazyGet('aura/html:helper'); }
public function define(Container $di) { // Logger $di->set('aura/project-kernel:logger', $di->lazyNew('Monolog\\Logger')); // Template engine $di->set('pollo/web:templating', $di->lazyNew('Pollo\\Web\\Templating\\TwigTemplateEngine', array('loader' => $di->lazyNew('\\Twig_Loader_Filesystem', array(__DIR__ . '/../src/Pollo/Web/Resources/templates')), 'options' => array('cache' => __DIR__ . '/../tmp/cache/twig')))); // Web request / response $di->set('pollo/web:request', $di->lazyNew('Pollo\\Web\\Http\\Request', array('request' => $di->lazyGet('aura/web-kernel:request')))); $di->set('pollo/web:response', $di->lazyNew('Pollo\\Web\\Http\\Response', array('response' => $di->lazyGet('aura/web-kernel:response')))); // Router $di->set('pollo/web:router', $di->lazyNew('Pollo\\Web\\Router\\Router', array('router' => $di->lazyGet('aura/web-kernel:router')))); // Command bus $di->set('pollo/command-bus', $di->lazyNew('Broadway\\CommandHandling\\SimpleCommandBus')); // Web/Domain adapter $di->set('pollo/adapter:web-domain-adapter', $di->lazyNew('Pollo\\Adapter\\WebDomainAdapter', array('bus' => $di->lazyGet('pollo/command-bus'), 'mapper' => $di->lazyNew('Pollo\\Adapter\\Mapper\\WebCommandMapper')))); // Web controller parameters $di->params['Pollo\\Web\\Controller\\Controller'] = array('request' => $di->lazyGet('pollo/web:request'), 'response' => $di->lazyGet('pollo/web:response'), 'templating' => $di->lazyGet('pollo/web:templating'), 'router' => $di->lazyGet('pollo/web:router'), 'domain' => $di->lazyGet('pollo/adapter:web-domain-adapter')); // EventStore client $di->set('pollo/event-store-client', $di->lazyNew('EventStore\\EventStore', array('url' => 'http://127.0.0.1:2113'))); // Event store $di->set('pollo/core:event-store', $di->lazyNew('Pollo\\Core\\EventStore\\EventStore', array('eventStore' => $di->lazyGet('pollo/event-store-client')))); // Event publisher $di->set('pollo/core:event-bus', $di->lazyNew('Broadway\\EventHandling\\SimpleEventBus')); // Domain repositories $di->set('pollo/core:poll-repository', $di->lazyNew('Pollo\\Core\\Domain\\Repository\\PollRepository', array('eventStore' => $di->lazyGet('pollo/core:event-store'), 'eventBus' => $di->lazyGet('pollo/core:event-bus')))); // Elastic search client $di->set('pollo/elasticsearch-client', $di->lazyNew('ElasticSearch\\Client')); // Serializer $di->set('pollo/core:serializer', $di->lazyNew('Pollo\\Core\\Serializer\\Serializer')); // Read model repository factory $di->set('pollo/core/read-model:repository-factory', $di->lazyNew('Pollo\\Core\\ReadModel\\Repository\\RepositoryFactory', array('client' => $di->lazyGet('pollo/elasticsearch-client'), 'serializer' => $di->lazyGet('pollo/core:serializer')))); // Read model projectors $di->set('pollo/core/read-model:poll-projector', $di->lazyNew('Pollo\\Core\\ReadModel\\Projector\\PollProjector', array('factory' => $di->lazyGet('pollo/core/read-model:repository-factory')))); }
/** * Define Auth * * @param Container $di DESCRIPTION * * @return mixed * * @access protected * * @SuppressWarnings(PHPMD.ShortVariable) */ protected function defineAuth(Container $di) { $di->params['Aura\\Auth\\AuthFactory']['cookie'] = $di->lazyValue('cookie'); $di->set('aura/auth:factory', $di->lazyNew('Aura\\Auth\\AuthFactory')); if (!$di->has('aura/auth:adapter')) { $di->set('aura/auth:adapter', $di->lazyNew('Aura\\Auth\\Adapter\\NullAdapter')); } $di->set('aura/auth:auth', $di->lazyGetCall('aura/auth:factory', 'newInstance')); $di->set('aura/auth:login', $di->lazyGetCall('aura/auth:factory', 'newLoginService', $di->lazyGet('aura/auth:adapter'))); $di->set('aura/auth:logout', $di->lazyGetCall('aura/auth:factory', 'newLogoutService', $di->lazyGet('aura/auth:adapter'))); $di->set('aura/auth:resume', $di->lazyGetCall('aura/auth:factory', 'newResumeService', $di->lazyGet('aura/auth:adapter'))); }
public function define(Container $di) { $di->set('aura/project-kernel:logger', $di->lazyNew('Monolog\\Logger')); $di->params['App\\Actions\\Hello'] = array('request' => $di->lazyGet('aura/web-kernel:request'), 'response' => $di->lazyGet('aura/web-kernel:response')); }