Inheritance: extends Interop\Container\ContainerInterface
示例#1
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  *
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $pluginManager = $serviceLocator->get('Phpro\\MailManager\\PluginManager');
     $adapter = $serviceLocator->get('Phpro\\MailManager\\DefaultAdapter');
     $instance = new Instance($pluginManager, $adapter);
     return $instance;
 }
示例#2
0
 public function createServiceWithName(ServiceLocatorInterface $serviceLocator, $name, $requestedName)
 {
     $entity = substr($requestedName, 18);
     $em = $serviceLocator->get('doctrine.entitymanager.orm_default');
     $repository = $em->getRepository('Fulbis\\Core\\Entity\\' . $entity);
     return $repository;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('DbAdapter');
     $hydrator = new HydratingResultSet(new ClassMethods(), new OrderItemEntity());
     $tableGateway = new TableGateway('order_items', $dbAdapter, null, $hydrator);
     return $tableGateway;
 }
示例#4
0
 /**
  * Factory method.
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $service = new PicService();
     $service->setEntityManager($serviceLocator->get('Doctrine\\ORM\\EntityManager'));
     $service->setAuthService($serviceLocator->get('zfcuser_auth_service'));
     return $service;
 }
 public function createService(ServiceLocatorInterface $pluginManager)
 {
     $serviceManager = $pluginManager->getServiceLocator();
     return new JSONErrorResponse($serviceManager);
     // return
     // $serviceManager->get('Application\Controller\Plugin\JSONErrorResponse');
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     try {
         $pdo = $pdo = new \PDO($config['dbAdapterPostgre']['dsn'], $config['dbAdapterPostgre']['username'], $config['dbAdapterPostgre']['password']);
         $sql = "          \n            SELECT                \n                REPLACE(TRIM(SUBSTRING(crypt(sf_private_key_value,gen_salt('xdes')),6,20)),'/','*') AS public_key\n                FROM info_users a \n                INNER JOIN sys_acl_roles sar ON sar.id = a.role_id AND sar.active=0 AND sar.deleted=0 \n                WHERE a.username = :username \n                    AND a.password = :password   \n                    AND a.deleted = 0 \n                    AND a.active = 0 \n                    Limit 1 \n                \n                                 ";
         $statement = $pdo->prepare($sql);
         $statement->bindValue(':username', $_POST['eposta'], \PDO::PARAM_STR);
         $statement->bindValue(':password', md5($_POST['sifre']), \PDO::PARAM_STR);
         //echo debugPDO($sql, $parameters);
         $statement->execute();
         $result = $statement->fetchAll(\PDO::FETCH_ASSOC);
         $publicKey = true;
         if (isset($result[0]['public_key'])) {
             $publicKey = $result[0]['public_key'];
         }
         $errorInfo = $statement->errorInfo();
         if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) {
             throw new \PDOException($errorInfo[0]);
         }
         //return array("found" => true, "errorInfo" => $errorInfo, "resultSet" => $result);
         return $publicKey;
     } catch (\PDOException $e) {
         $pdo->rollback();
         return array("found" => false, "errorInfo" => $e->getMessage());
     }
     //return false;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     $dbOptions = $config['db'];
     $db = new Adapter($dbOptions);
     return $db;
 }
 public function initialize($instance, ServiceLocatorInterface $serviceLocator)
 {
     if ($instance instanceof TagReaderAwareInterface) {
         $tagReader = $serviceLocator->get('DocBlockTags\\TagReader');
         $instance->setTagReader($tagReader);
     }
 }
 /**
  * Create the DefaultAuthorizationListener
  *
  * @param ServiceLocatorInterface $services
  * @return DefaultAuthorizationListener
  */
 public function createService(ServiceLocatorInterface $services)
 {
     if (!$services->has('ZF\\MvcAuth\\Authorization\\AuthorizationInterface')) {
         throw new ServiceNotCreatedException('Cannot create DefaultAuthorizationListener service; ' . 'no ZF\\MvcAuth\\Authorization\\AuthorizationInterface service available!');
     }
     return new DefaultAuthorizationListener($services->get('ZF\\MvcAuth\\Authorization\\AuthorizationInterface'));
 }
示例#10
0
 /**
  * Create Service
  *
  * @param ServiceLocatorInterface $serviceLocator Zend Service Manager
  *
  * @return Stream
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config');
     $path = $config['rcmLogWriter']['logPath'];
     $writer = new Stream($path);
     return $writer;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $em = $serviceLocator->get('doctrine.entitymanager.orm_default');
     $options = $serviceLocator->get('BiBoBlogOptions');
     $form = new \BiBoBlog\Form\BiBoBlogForm($em, $options);
     return $form;
 }
示例#12
0
 /**
  * Create and return the router
  *
  * Retrieves the "router" key of the Config service, and uses it
  * to instantiate the router. Uses the TreeRouteStack implementation by
  * default.
  *
  * @param  ServiceLocatorInterface        $serviceLocator
  * @param  string|null                     $cName
  * @param  string|null                     $rName
  * @return \Zend\Mvc\Router\RouteStackInterface
  */
 public function createService(ServiceLocatorInterface $serviceLocator, $cName = null, $rName = null)
 {
     $config = $serviceLocator->has('Config') ? $serviceLocator->get('Config') : array();
     // Defaults
     $routerClass = 'Zend\\Mvc\\Router\\Http\\TreeRouteStack';
     $routerConfig = isset($config['router']) ? $config['router'] : array();
     // Console environment?
     if ($rName === 'ConsoleRouter' || $cName === 'router' && Console::isConsole()) {
         // We are in a console, use console router defaults.
         $routerClass = 'Zend\\Mvc\\Router\\Console\\SimpleRouteStack';
         $routerConfig = isset($config['console']['router']) ? $config['console']['router'] : array();
     }
     // Obtain the configured router class, if any
     if (isset($routerConfig['router_class']) && class_exists($routerConfig['router_class'])) {
         $routerClass = $routerConfig['router_class'];
     }
     // Inject the route plugins
     if (!isset($routerConfig['route_plugins'])) {
         $routePluginManager = $serviceLocator->get('RoutePluginManager');
         $routerConfig['route_plugins'] = $routePluginManager;
     }
     // Obtain an instance
     $factory = sprintf('%s::factory', $routerClass);
     return call_user_func($factory, $routerConfig);
 }
 /**
  * Creates a {@link SocialProfilesFieldset}
  *
  * Uses config from the config key [form_element_config][attach_social_profiles_fieldset]
  * to configure fetch_url, preview_url and name or uses the defaults:
  *  - fetch_url: Route named "auth-social-profiles" with the suffix "?network=%s"
  *  - preview_url: Route named "lang/applications/detail" with the suffix "?action=social-profile&network=%s"
  *  - name: "social_profiles"
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return SocialProfilesFieldset
  * @see \Zend\ServiceManager\FactoryInterface::createService()
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var $serviceLocator \Zend\Form\FormElementManager
      * @var $router         \Zend\Mvc\Router\RouteStackInterface */
     $services = $serviceLocator->getServiceLocator();
     $router = $services->get('Router');
     $config = $services->get('Config');
     $options = isset($config['form_element_config']['attach_social_profiles_fieldset']) ? $config['form_element_config']['attach_social_profiles_fieldset'] : array();
     if (!isset($options['fetch_url'])) {
         $options['fetch_url'] = $router->assemble(array('action' => 'fetch'), array('name' => 'auth-social-profiles')) . '?network=%s';
     }
     if (!isset($options['preview_url'])) {
         $options['preview_url'] = $router->assemble(array('id' => 'null'), array('name' => 'lang/applications/detail'), true) . '?action=social-profile&network=%s';
     }
     if (isset($options['name'])) {
         $name = $options['name'];
         unset($options['name']);
     } else {
         $name = 'social_profiles';
     }
     $options['is_disable_capable'] = false;
     $options['is_disable_elements_capable'] = false;
     $fieldset = new SocialProfilesFieldset($name, $options);
     return $fieldset;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /** @var \Detail\Apigility\View\JsonRenderer $renderer */
     $renderer = $serviceLocator->get('Detail\\Apigility\\View\\JsonRenderer');
     $strategy = new JsonStrategy($renderer);
     return $strategy;
 }
 /**
  * Create and return a view manager based on detected environment
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return ConsoleViewManager|HttpViewManager
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     if (Console::isConsole()) {
         return $serviceLocator->get('ConsoleViewManager');
     }
     return $serviceLocator->get('HttpViewManager');
 }
示例#16
0
 /**
  * Prepare Exam service
  * 
  * @uses Exam
  * 
  * @access public
  * @param ServiceLocatorInterface $serviceLocator
  * @return Exam
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $query = $serviceLocator->get('wrapperQuery')->setEntity('Courses\\Entity\\ExamBook');
     $systemCacheHandler = $serviceLocator->get('systemCacheHandler');
     $notification = $serviceLocator->get('Notifications\\Service\\Notification');
     return new Exam($query, $systemCacheHandler, $notification);
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $hydrator = new TenStreetHydrator(false);
     $parentlocator = $serviceLocator->getServiceLocator();
     $hydrator->addStrategy('DisplayFields', new DisplayFieldHydratorStrategy($parentlocator->get('DisplayFieldHydrator')));
     return $hydrator;
 }
示例#18
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $adapter = $serviceLocator->get('Zend\\Db\\Adapter\\Adapter');
     $entity = $serviceLocator->get('Techtree\\Entity\\Research');
     $table = new ResearchTable($adapter, $entity);
     return $table;
 }
示例#19
0
 /**
  * {@inheritDoc}
  *
  * @return ProviderPluginManager
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('Config')['cmspermissions']['acl']['resource_provider_manager'];
     $pluginManager = new ProviderPluginManager(new Config($config));
     $pluginManager->setServiceLocator($serviceLocator);
     return $pluginManager;
 }
 public function createService(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
 {
     $sysServicesGroups = new \DAL\PDO\SysServicesGroups();
     $slimapp = $serviceLocator->get('slimapp');
     $sysServicesGroups->setSlimApp($slimapp);
     return $sysServicesGroups;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $realServiceLocator = $serviceLocator->getServiceLocator();
     $postService = $realServiceLocator->get('Blog\\Service\\PostServiceInterface');
     $emailService = $realServiceLocator->get('Blog\\Service\\EmailServiceInterface');
     return new AdminController($postService, $emailService);
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /* @var \Rbac\Traversal\Strategy\TraversalStrategyInterface $traversalStrategy */
     $traversalStrategy = $serviceLocator->getServiceLocator()->get('Rbac\\Rbac')->getTraversalStrategy();
     $assertion = new PageAssertion($traversalStrategy);
     return $assertion;
 }
示例#23
0
 /**
  * Inject service locator
  *
  * @param ServiceLocatorInterface $serviceLocator ServiceLocator
  *
  * @return void
  */
 public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
 {
     $this->serviceLocator = $serviceLocator;
     $config = new Config($serviceLocator->get('Config'));
     $this->ignoredCssFiles = $config->swissbib->ignore_css_assets->toArray();
     $this->ignoredJsFiles = $config->swissbib->ignore_js_assets->toArray();
 }
示例#24
0
 /**
  * {@inheritdoc}
  * @codeCoverageIgnore
  */
 public function __construct(\Zend\ServiceManager\ServiceLocatorInterface $serviceLocator)
 {
     $this->table = 'drives';
     $this->_hydrator = new \Database\Hydrator\Filesystems();
     $this->resultSetPrototype = new \Zend\Db\ResultSet\HydratingResultSet($this->_hydrator, $serviceLocator->get('Model\\Client\\Item\\Filesystem'));
     parent::__construct($serviceLocator);
 }
示例#25
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $mapper = new MethodMapper();
     $mapper->setEntityPrototype($serviceLocator->get('app_method'));
     $mapper->setHydrator($serviceLocator->get('app_method_hydrator'));
     return $mapper;
 }
 /**
  * Reset form factory
  *
  * @param  ServiceLocatorInterface $serviceLocator
  * @return ResetForm
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $options = $serviceLocator->get('User\\Password\\Options');
     $form = new ResetForm(null, $options);
     $form->setInputFilter(new ResetFormFilter());
     return $form;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $router = $serviceLocator->get('Router');
     $application = $serviceLocator->get('Application');
     $options = $serviceLocator->get('zfcuser_module_options');
     return new RedirectCallback($application, $router, $options);
 }
示例#28
0
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return null|StorageInterface
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $config = $serviceLocator->get('config');
     self::$cache = StorageFactory::factory(isset($config['cache']) ? $config['cache'] : array());
     //        self::$cache->flush();
     return self::$cache;
 }
 /**
  * {@inheritDoc}
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     /** @var \Detail\Commanding\Options\ModuleOptions $moduleOptions */
     $moduleOptions = $serviceLocator->get('Detail\\Commanding\\Options\\ModuleOptions');
     /** @var \Detail\Commanding\CommandHandlerManager $commandHandlerManager */
     $commandHandlerManager = $serviceLocator->get('Detail\\Commanding\\CommandHandlerManager');
     $commandHandlerManager->setServiceLocator($serviceLocator);
     $commandDispatcher = new CommandDispatcher($commandHandlerManager);
     $commands = $moduleOptions->getCommands();
     foreach ($commands as $command) {
         if (!isset($command['command'])) {
             throw new Exception\ConfigException('Command is missing required configuration option "command"');
         }
         if (!isset($command['handler'])) {
             throw new Exception\ConfigException('Command is missing required configuration option "handler"');
         }
         $commandDispatcher->register($command['command'], $command['handler']);
     }
     $listeners = $moduleOptions->getListeners();
     foreach ($listeners as $listenerName) {
         /** @todo Lazy load listeners? */
         /** @var ListenerAggregateInterface $listener */
         $listener = $serviceLocator->get($listenerName);
         $listener->attach($commandDispatcher->getEventManager());
     }
     return $commandDispatcher;
 }
 /**
  * Create service
  *
  * @param ServiceLocatorInterface $serviceLocator
  * @return mixed
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $entityManager = $serviceLocator->get('Doctrine\\ORM\\EntityManager');
     $adapter = new Adapter($entityManager);
     $adapter->setEm($entityManager);
     return new AuthenticationService(new Session(), $adapter);
 }