Exemple #1
0
 public function getServiceConfig()
 {
     return array('factories' => array('OAuth2Server' => function ($sm) {
         return $sm->get('OAuth2Factory');
     }, 'OAuth2Factory' => function ($sm) {
         $oauth2Factory = $sm->get('ZF\\OAuth2\\Service\\OAuth2Server');
         $sm->setFactory('OAuth2FactoryInstance', $oauth2Factory);
         return $sm->get('OAuth2FactoryInstance');
     }, 'PersonNameHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'PostalAddressHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'PostalAddressHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'DisplayFieldHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'ContactDataHydrator' => function ($sm) {
         $hydrator = new TenStreetHydrator(false);
         $hydrator->addStrategy('PrimaryPhone', new PhoneNumberStrategy());
         $hydrator->setNamingStrategy(new MapperNamingStrategy(array('attributes' => '@attributes')));
         return $hydrator;
     }, 'AuthenticationHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'AuthTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $hydrator = $sm->get('AuthenticationHydrator');
         $entityPrototype = new AuthEntity();
         $resultset = new HydratingResultSet($hydrator, $entityPrototype);
         return new TableGateway('authentication', $dbAdapter, null, $resultset);
     }, 'TenStreet\\Model\\AuthTable' => function ($sm) {
         $tableGateway = $sm->get('AuthTableGateway');
         $table = new AuthTable($tableGateway, $sm);
         return $table;
     }, 'TenStreetDataMapper' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new TenStreetDataMapper($sm, $dbAdapter);
     }, 'Logger' => function ($sm) {
         $config = $sm->get('config');
         $logger = new \Zend\Log\Logger();
         if (isset($config['log']['file']) && is_writable(dirname($config['log']['file']))) {
             $writer = new \Zend\Log\Writer\Stream($config['log']['file']);
             $logger->addWriter($writer);
         }
         return $logger;
     }));
 }
Exemple #2
0
 public function getServiceConfig()
 {
     return array('factories' => array('OAuth2Server' => function ($sm) {
         return $sm->get('OAuth2Factory');
     }, 'OAuth2Factory' => function ($sm) {
         $oauth2Factory = $sm->get('ZF\\OAuth2\\Service\\OAuth2Server');
         $sm->setFactory('OAuth2FactoryInstance', $oauth2Factory);
         return $sm->get('OAuth2FactoryInstance');
     }, 'TenStreet\\Hydrator\\PersonNameHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'TenStreet\\Hydrator\\PostalAddressHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'TenStreet\\Hydrator\\DisplayFieldHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'TenStreet\\Hydrator\\LicenseHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'TenStreet\\Hydrator\\ContactDataHydrator' => function ($sm) {
         $hydrator = new TenStreetHydrator(false);
         $hydrator->addStrategy('PrimaryPhone', new PhoneNumberStrategy());
         $hydrator->setNamingStrategy(new MapperNamingStrategy(array('attributes' => '@attributes')));
         return $hydrator;
     }, 'TenStreet\\Hydrator\\AuthenticationHydrator' => function ($sm) {
         return new TenStreetHydrator(false);
     }, 'TenStreetDataMapper' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new TenStreetDataMapper($sm, $dbAdapter);
     }, 'Logger' => function ($sm) {
         $config = $sm->get('config');
         $logger = new \Zend\Log\Logger();
         if (isset($config['log']['file']) && is_writable(dirname($config['log']['file']))) {
             $writer = new \Zend\Log\Writer\Stream($config['log']['file']);
             $logger->addWriter($writer);
         }
         return $logger;
     }));
 }