Esempio n. 1
0
 public static function getServiceConfig($owner, $modelName, $table, $mapper)
 {
     $adapter = static::getAdapter($owner);
     $resultSet = new \Zend\Db\ResultSet\ResultSet();
     $resultSet->setArrayObjectPrototype(new $modelName());
     $tableGateway = new \Zend\Db\TableGateway\TableGateway($table, $adapter, null, $resultSet);
     $returning_mapper = new $mapper($tableGateway);
     return $returning_mapper;
 }
 protected function createProduct(array $data)
 {
     $sm = $this->getServiceLocator();
     $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
     $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new \Store\Model\Product());
     $tableGateway = new \Zend\Db\TableGateway\TableGateway('product', $dbAdapter, null, $resultSetPrototype);
     $product = new Product();
     $product->exchangeArray($data);
     $productTable = new ProductTable($tableGateway);
     $productTable->saveProduct($product);
     return true;
 }
 protected function createUser(array $data)
 {
     $sm = $this->getServiceLocator();
     $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
     $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new \Users\Model\User());
     $tableGateway = new \Zend\Db\TableGateway\TableGateway('user', $dbAdapter, null, $resultSetPrototype);
     $user = new User();
     $user->exchangeArray($data);
     $userTable = new UserTable($tableGateway);
     $userTable->saveUser($user);
     return true;
 }
Esempio n. 4
0
 public function getServiceConfig()
 {
     return array('factories' => array('Album\\Model\\AlbumTable' => function ($sm) {
         $tableGateway = $sm->get('AlbumTableGateway');
         $table = new Model\AlbumTable($tableGateway);
         return $table;
     }, 'AlbumTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\Album());
         return new \Zend\Db\TableGateway\TableGateway('album', $dbAdapter, null, $resultSetPrototype);
     }));
 }
 protected function createOpportunity(array $data)
 {
     $sm = $this->getServiceLocator();
     $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
     $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new \Opportunity\Model\Opportunity());
     $tableGateway = new \Zend\Db\TableGateway\TableGateway('user', $dbAdapter, null, $resultSetPrototype);
     $opportunity = new Opportunity();
     $opportunity->exchangeArray($data);
     $opportunityTable = new OpportunityTable($tableGateway);
     $opportunityTable->saveOpportunity($opportunity);
     return true;
 }
Esempio n. 6
0
 public function fetchAll($paginated = false)
 {
     if ($paginated) {
         // create a new Select object for the table album
         $select = new \Zend\Db\Sql\Select('album');
         // create a new result set based on the Album entity
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Album());
         // create a new pagination adapter object
         $paginatorAdapter = new \Zend\Paginator\Adapter\DbSelect($select, $this->tableGateway->getAdapter(), $resultSetPrototype);
         $paginator = new \Zend\Paginator\Paginator($paginatorAdapter);
         return $paginator;
     }
     $resultSet = $this->tableGateway->select();
     return $resultSet;
 }
Esempio n. 7
0
 /**
  * @param ServiceLocatorInterface $locator
  * @param $name
  * @param $requestedName
  * @return AbstractTable
  */
 public function createServiceWithName(ServiceLocatorInterface $locator, $name, $requestedName)
 {
     $entityClass = 'Component\\Data\\Entity\\' . str_replace('Table', 'Entity', $requestedName);
     $recordClass = str_replace('Table', 'Model', $requestedName);
     $tableClass = 'Component\\Data\\Table\\' . $requestedName;
     /** @var \Zend\Db\Adapter\Adapter $adapter */
     $adapter = $locator->get('Zend\\Db\\Adapter\\Adapter');
     #region resultSet
     /** @var AbstractModel $record */
     $record = $locator->get($recordClass);
     $resultSet = new \Zend\Db\ResultSet\ResultSet();
     $resultSet->setArrayObjectPrototype($record);
     #endregion
     /** @var EntityInterface $entity */
     $entity = new $entityClass();
     $tableData = new \Zend\Db\TableGateway\TableGateway($entity->getTableName(), $adapter, null, $resultSet);
     $table = new $tableClass($tableData, $entity);
     return $table;
 }
Esempio n. 8
0
 public function fetchAll($where = '', $order = '', $limit = '', $paginated = '')
 {
     if ($paginated) {
         $select = new \Zend\Db\Sql\Select('hwi_product');
         if (is_array($where)) {
             $select->where($where);
         }
         if (is_array($order)) {
             foreach ($order as $key => $value) {
                 $select->order($value);
             }
         }
         $rs = new \Zend\Db\ResultSet\ResultSet();
         $rs->setArrayObjectPrototype(new product());
         $pageAdapter = new \Zend\Paginator\Adapter\DbSelect($select, $this->tableGateway->getAdapter(), $rs);
         $paginator = new \Zend\Paginator\Paginator($pageAdapter);
         return $paginator;
     }
     $resultSet = $this->tableGateway->select($where, $order, $limit);
     return $resultSet;
 }
Esempio n. 9
0
 public function indexAction()
 {
     /* Instanciation d'un tableGateway pour country */
     $sm = $this->getServiceLocator();
     $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
     $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new Country());
     $tableGateWay = new TableGateway('country', $dbAdapter, null, $resultSetPrototype);
     $countryTable = new CountryTable($tableGateWay);
     $form = new Form\Register();
     $libelleValidation = "";
     if ($this->request->isPost()) {
         $dataPosted = $this->request->getPost();
         //var_dump($dataPosted);
         /* S'il a cliqué sur le bouton suppression, on supprime l'id, sinon c'est un create ou update */
         if (isset($dataPosted->suppression)) {
             $countryTable->deleteCountry($dataPosted->id);
         } else {
             $formReceivedData = new Form\Register();
             $formReceivedData->setData($dataPosted);
             if ($formReceivedData->isValid()) {
                 $libelleValidation = "Enregistrement effectué ";
                 $newCountry = new Country();
                 $newCountry->exchangeArray($dataPosted);
                 $countryTable->saveCountry($newCountry);
             } else {
                 $libelleValidation = "Les données inserées ne sont pas valides";
                 $form->setData($dataPosted);
             }
         }
     }
     //saveCountry
     $form2 = new Form\RegisterArrayLine();
     $allCountries = $countryTable->fetchAll();
     $viewModel = new ViewModel(["allCountries" => $allCountries, "form" => $form, "form2" => $form2, "libelleValidation" => $libelleValidation]);
     return $viewModel;
 }
Esempio n. 10
0
 public function singleRecordAction()
 {
     $retour = array();
     $iso = $this->params('iso3166');
     $request = new \Zend\Http\PhpEnvironment\Request();
     $methode = $request->getServer('REQUEST_METHOD');
     if (isset($iso)) {
         $retour["search"] = $iso;
         $sm = $this->getServiceLocator();
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Country());
         $tableGateWay = new TableGateway('country', $dbAdapter, null, $resultSetPrototype);
         $countryTable = new CountryTable($tableGateWay);
         switch ($methode) {
             case "GET":
                 $country = $countryTable->getCountryWithSearch($iso);
                 if (isset($country)) {
                     $retour[] = $country->toArray();
                 } else {
                     $retour["error"] = "Pas de resultat";
                 }
                 break;
             case "PATCH":
                 $country = $countryTable->getCountryWithSearch($iso);
                 if (isset($country)) {
                     $postContent = $request->getContent();
                     if (trim($postContent)) {
                         //$retour["content"] = json_decode($postContent);
                         $formReceivedData = new Form\Register();
                         $formReceivedData->setData(json_decode($postContent, true));
                         //$retour["insert"] = json_decode($postContent,true);
                         if ($formReceivedData->isValid()) {
                             $newCountry = new Country();
                             $newCountry->exchangeArray(json_decode($postContent, true));
                             $countryTable->saveCountry($newCountry);
                             $retour["success"] = "Donnees valides";
                         } else {
                             $retour["error"] = "Donnees recues non valides";
                         }
                     } else {
                         $retour["error"] = "Pas de donnees recues";
                     }
                 } else {
                     $retour["error"] = "Pays non trouve";
                 }
                 break;
             case "DELETE":
                 $country = $countryTable->getCountryWithSearch($iso);
                 if (isset($country)) {
                     $countryTable->deleteCountryWithSearch($iso);
                     $retour["success"] = "Suppression reussie";
                 } else {
                     $retour["error"] = "Pays non trouve";
                 }
                 break;
             default:
                 $retour["error"] = "405 : Forbidden method";
                 break;
         }
     } else {
         $retour["error"] = "Pas d'iso3166 specifie";
     }
     return new JsonModel($retour);
 }
Esempio n. 11
0
 public function getServiceConfig()
 {
     return array('factories' => array('UserTable' => function ($sm) {
         $tableGateway = $sm->get('UserTableGateway');
         $table = new Model\UserTable($tableGateway);
         return $table;
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\User());
         return new \Zend\Db\TableGateway\TableGateway(Model\UserTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }, 'ProductsTable' => function ($sm) {
         $tableGateway = $sm->get('ProductsTableGateway');
         $table = new Model\ProductsTable($tableGateway);
         return $table;
     }, 'ProductsTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\Products());
         return new \Zend\Db\TableGateway\TableGateway(Model\ProductsTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }, 'ShopkeeperTable' => function ($sm) {
         $tableGateway = $sm->get('ShopkeeperTableGateway');
         $table = new Model\ShopkeeperTable($tableGateway);
         return $table;
     }, 'ShopkeeperTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\Shopkeeper());
         return new \Zend\Db\TableGateway\TableGateway(Model\ShopkeeperTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }, 'AddressTable' => function ($sm) {
         $tableGateway = $sm->get('AddressTableGateway');
         $table = new Model\AddressTable($tableGateway);
         return $table;
     }, 'AddressTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\Address());
         return new \Zend\Db\TableGateway\TableGateway(Model\AddressTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }, 'CouponTable' => function ($sm) {
         $tableGateway = $sm->get('CouponTableGateway');
         $table = new Model\CouponTable($tableGateway);
         return $table;
     }, 'CouponTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\Coupon());
         return new \Zend\Db\TableGateway\TableGateway(Model\CouponTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }, 'OrderTable' => function ($sm) {
         $tableGateway = $sm->get('OrderTableGateway');
         $table = new Model\OrderTable($tableGateway);
         return $table;
     }, 'OrderTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\Order());
         return new \Zend\Db\TableGateway\TableGateway(Model\OrderTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }, 'UserRoleTable' => function ($sm) {
         $tableGateway = $sm->get('UserRoleTableGateway');
         $table = new Model\UserRoleTable($tableGateway);
         return $table;
     }, 'UserRoleTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('dbAdapter');
         $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Model\UserRole());
         return new \Zend\Db\TableGateway\TableGateway(Model\UserRoleTable::TABLE_NAME, $dbAdapter, null, $resultSetPrototype);
     }));
 }
Esempio n. 12
0
<?php

return array('router' => array('routes' => array('home' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'CountryReferential\\Controller\\Index', 'action' => 'index'))), 'api_get_delete' => array('type' => 'segment', 'options' => array('route' => '/api/country[/:code]', 'defaults' => array('__NAMESPACE__' => 'CountryReferential\\Controller', 'controller' => 'Api', 'action' => 'index'))), 'api_admin' => array('type' => 'Literal', 'options' => array('route' => '/admin/api', 'defaults' => array('__NAMESPACE__' => 'CountryReferential\\Controller', 'controller' => 'Admin', 'action' => 'index')), 'may_terminate' => true, 'child_routes' => array('default' => array('type' => 'Segment', 'options' => array('route' => '/[:controller/[:action]]', 'constraints' => array('controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*'), 'defaults' => array())))), 'api_admin_delete' => array('type' => 'segment', 'options' => array('route' => '/admin/api/delete/[:code]', 'defaults' => array('__NAMESPACE__' => 'CountryReferential\\Controller', 'controller' => 'Admin', 'action' => 'delete'))), 'api_admin_update' => array('type' => 'segment', 'options' => array('route' => '/admin/api/update/[:code]', 'defaults' => array('__NAMESPACE__' => 'CountryReferential\\Controller', 'controller' => 'Admin', 'action' => 'countryUpdate'))), 'api_admin_create' => array('type' => 'segment', 'options' => array('route' => '/admin/api/create', 'defaults' => array('__NAMESPACE__' => 'CountryReferential\\Controller', 'controller' => 'Admin', 'action' => 'countryCreate'))))), 'service_manager' => array('abstract_factories' => array('Zend\\Cache\\Service\\StorageCacheAbstractServiceFactory', 'Zend\\Log\\LoggerAbstractServiceFactory'), 'factories' => array('translator' => 'Zend\\Mvc\\Service\\TranslatorServiceFactory', 'pays-table' => function ($sm) {
    $tableGateway = $sm->get('pays-table-gateway');
    $table = new \CountryReferential\Model\PaysTable($tableGateway);
    return $table;
}, 'pays-table-gateway' => function ($sm) {
    $dbAdapter = $sm->get('Zend\\db\\Adapter\\Adapter');
    $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
    $resultSetPrototype->setArrayObjectPrototype(new \CountryReferential\Model\Pays());
    return new \Zend\Db\TableGateway\TableGateway('pays', $dbAdapter, null, $resultSetPrototype);
})), 'translator' => array('locale' => 'en_US', 'translation_file_patterns' => array(array('type' => 'gettext', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.mo'))), 'controllers' => array('invokables' => array('CountryReferential\\Controller\\Index' => 'CountryReferential\\Controller\\IndexController', 'CountryReferential\\Controller\\Api' => 'CountryReferential\\Controller\\ApiController', 'CountryReferential\\Controller\\Admin' => 'CountryReferential\\Controller\\AdminController')), 'view_manager' => array('display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => array('layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 'layout/error' => __DIR__ . '/../view/layout/error.phtml', 'country-referencial/index/index' => __DIR__ . '/../view/country-referencial/index/index.phtml', 'country-referencial/api/index' => __DIR__ . '/../view/country-referencial/api/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml'), 'template_path_stack' => array(__DIR__ . '/../view'), 'strategies' => array('ViewJsonStrategy')), 'console' => array('router' => array('routes' => array())));
Esempio n. 13
0
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */
return array('router' => array('routes' => array('home' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'Application\\Controller\\Index', 'action' => 'index'))), 'list' => array('type' => 'literal', 'options' => array('route' => '/document/list', 'defaults' => array('controller' => 'Application\\Controller\\Document', 'action' => 'list')), 'may_terminate' => true), 'detail' => array('type' => 'segment', 'options' => array('route' => '/document/detail[/:doc]', 'constraints' => array('doc' => '[0-9]*'), 'defaults' => array('controller' => 'Application\\Controller\\Document', 'action' => 'detail')), 'may_terminate' => true), 'detail-error' => array('type' => 'segment', 'options' => array('route' => '/document/detail[/:doc][/:email]', 'constraints' => array('doc' => '[0-9]*', 'email' => '[0-1]'), 'defaults' => array('controller' => 'Application\\Controller\\Document', 'action' => 'detail')), 'may_terminate' => true), 'purchase' => array('type' => 'segment', 'options' => array('route' => '/document/purchase[/:doc]', 'constraints' => array('doc' => '[0-9]*'), 'defaults' => array('controller' => 'Application\\Controller\\Document', 'action' => 'purchase')), 'may_terminate' => true), 'application' => array('type' => 'Literal', 'options' => array('route' => '/application', 'defaults' => array('__NAMESPACE__' => 'Application\\Controller', 'controller' => 'Index', 'action' => 'index')), 'may_terminate' => true, 'child_routes' => array('default' => array('type' => 'Segment', 'options' => array('route' => '/[:controller[/:action]]', 'constraints' => array('controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*'), 'defaults' => array())))))), 'service_manager' => array('abstract_factories' => array('Zend\\Cache\\Service\\StorageCacheAbstractServiceFactory', 'Zend\\Log\\LoggerAbstractServiceFactory'), 'factories' => array('translator' => 'Zend\\Mvc\\Service\\TranslatorServiceFactory', 'DocumentTable' => function ($sm) {
    $tableGateway = $sm->get('DocumentTableGateway');
    $table = new \Application\Model\DocumentTable($tableGateway);
    return $table;
}, 'PurchaseTable' => function ($sm) {
    $tableGateway = $sm->get('PurchaseTableGateway');
    $table = new \Application\Model\PurchaseTable($tableGateway);
    return $table;
}, 'DocumentTableGateway' => function ($sm) {
    $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
    $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
    $resultSetPrototype->setArrayObjectPrototype(new \Application\Model\Document());
    //Set result set types (in this instance Document model type) and table name
    return new \Zend\Db\TableGateway\TableGateway('document', $dbAdapter, null, $resultSetPrototype);
}, 'PurchaseTableGateway' => function ($sm) {
    $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
    $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
    //Set result set types (in this instance Document model type) and table name
    return new \Zend\Db\TableGateway\TableGateway('purchase', $dbAdapter, null, $resultSetPrototype);
}, 'DocumentTracker' => function () {
    //Returns the document tracker
    return new Application\Model\DocumentTracker($_COOKIE);
}, 'EmailValidator' => function () {
    //Returns an email address validator.
    $oValidator = new Zend\Validator\EmailAddress();
    return $oValidator;
}, 'EmailFilter' => function () {
Esempio n. 14
0
<?php

/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */
return array('router' => array('routes' => array('home' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'Application\\Controller\\Index', 'action' => 'index'))), 'application' => array('type' => 'Literal', 'options' => array('route' => '/application', 'defaults' => array('__NAMESPACE__' => 'Application\\Controller', 'controller' => 'Index', 'action' => 'index')), 'may_terminate' => true, 'child_routes' => array('default' => array('type' => 'Segment', 'options' => array('route' => '/[:controller[/:action]]', 'constraints' => array('controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*'), 'defaults' => array())))))), 'service_manager' => array('abstract_factories' => array('Zend\\Cache\\Service\\StorageCacheAbstractServiceFactory', 'Zend\\Log\\LoggerAbstractServiceFactory'), 'factories' => array('EntriesTableGateway' => function ($serviceManager) {
    $databaseAdapter = $serviceManager->get('Zend\\Db\\Adapter');
    $resultSet = new \Zend\Db\ResultSet\ResultSet();
    $resultSet->setArrayObjectPrototype(new \Application\Entity\Entry());
    $tableGateway = new \Zend\Db\TableGateway\TableGateway('entries', $databaseAdapter, null, $resultSet);
    return $tableGateway;
}, 'DatabaseTableStorage' => function ($serviceManager) {
    $storage = new \Application\Service\Storage\DatabaseTable($serviceManager->get('EntriesTableGateway'));
    return $storage;
}), 'invokables' => array('Application\\InputFilter\\EntryInputFilter' => 'Application\\InputFilter\\EntryInputFilter')), 'controllers' => array('factories' => array('Application\\Controller\\Index' => function ($controllerManager) {
    // We have to get the *actual* SM here as this is currently the controller manager derivative.
    $serviceManager = $controllerManager->getServiceLocator();
    $storage = $serviceManager->get('DatabaseTableStorage');
    $entryService = new \Application\Service\EntryService($storage);
    $inputFilter = $serviceManager->get('Application\\InputFilter\\EntryInputFilter');
    $controller = new \Application\Controller\IndexController();
    $controller->setEntryService($entryService);
    $controller->setEntryInputFilter($inputFilter);
    return $controller;
})), 'view_helpers' => array('invokables' => array('IntervalYearsDaysHours' => 'Application\\View\\Helper\\IntervalYearsDaysHours')), 'view_manager' => array('display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => array('layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml'), 'template_path_stack' => array(__DIR__ . '/../view')), 'console' => array('router' => array('routes' => array())));
Esempio n. 15
0
<?php

/**
 * Zend Framework (http://framework.zend.com/)
 *
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */
return array('router' => array('routes' => array('home' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'Application\\Controller\\Index', 'action' => 'index'))), 'application' => array('type' => 'Literal', 'options' => array('route' => '/application', 'defaults' => array('__NAMESPACE__' => 'Application\\Controller', 'controller' => 'Index', 'action' => 'index')), 'may_terminate' => true, 'child_routes' => array('default' => array('type' => 'Segment', 'options' => array('route' => '/[:controller[/:action]]', 'constraints' => array('controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*'), 'defaults' => array())))), 'post' => array('type' => 'segment', 'options' => array('route' => '/post[/][:action][/page/:page][/:id]', 'constraints' => array('action' => '[a-zA-Z][a-zA-Z0-9_-]*', 'id' => '[0-9]+'), 'defaults' => array('controller' => 'Application\\Controller\\Post', 'action' => 'index'))))), 'service_manager' => array('abstract_factories' => array('Zend\\Cache\\Service\\StorageCacheAbstractServiceFactory', 'Zend\\Log\\LoggerAbstractServiceFactory'), 'aliases' => array('translator' => 'MvcTranslator'), 'factories' => array('Application\\Model\\PostTableGateway' => function ($sm) {
    $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
    $resultSetPrototype = new Zend\Db\ResultSet\ResultSet();
    $resultSetPrototype->setArrayObjectPrototype(new Application\Model\Post());
    $tableGateway = new Zend\Db\TableGateway\TableGateway('posts', $dbAdapter, null, $resultSetPrototype);
    $postTableGateway = new Application\Model\PostTableGateway($tableGateway);
    return $postTableGateway;
}, 'Cache' => function ($sm) {
    $config = $sm->get('Config');
    $cache = \Zend\Cache\StorageFactory::factory(array('adapter' => $config['cache']['adapter'], 'plugins' => array('exception_handler' => array('throw_exceptions' => false), 'Serializer'), 'options' => $config['cache']['options']));
    return $cache;
})), 'translator' => array('locale' => 'pt_BR', 'translation_file_patterns' => array(array('type' => 'phparray', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.php'))), 'controllers' => array('invokables' => array('Application\\Controller\\Index' => 'Application\\Controller\\IndexController', 'Application\\Controller\\Post' => 'Application\\Controller\\PostController')), 'view_manager' => array('display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => array('layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 'application/index/index' => __DIR__ . '/../view/application/index/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml'), 'template_path_stack' => array(__DIR__ . '/../view')), 'console' => array('router' => array('routes' => array())));
Esempio n. 16
0
<?php

return array('router' => array('routes' => array('home' => array('type' => 'Zend\\Mvc\\Router\\Http\\Literal', 'options' => array('route' => '/', 'defaults' => array('controller' => 'RefPays\\Controller\\Index', 'action' => 'index'))), 'api_get_delete' => array('type' => 'segment', 'options' => array('route' => '/api/pays[/:code]', 'defaults' => array('__NAMESPACE__' => 'RefPays\\Controller', 'controller' => 'Api', 'action' => 'index'))), 'api_admin' => array('type' => 'Literal', 'options' => array('route' => '/admin/api', 'defaults' => array('__NAMESPACE__' => 'RefPays\\Controller', 'controller' => 'Admin', 'action' => 'index')), 'may_terminate' => true, 'child_routes' => array('default' => array('type' => 'Segment', 'options' => array('route' => '/[:controller/[:action]]', 'constraints' => array('controller' => '[a-zA-Z][a-zA-Z0-9_-]*', 'action' => '[a-zA-Z][a-zA-Z0-9_-]*'), 'defaults' => array())))), 'api_admin_delete' => array('type' => 'segment', 'options' => array('route' => '/admin/api/delete/[:code]', 'defaults' => array('__NAMESPACE__' => 'RefPays\\Controller', 'controller' => 'Admin', 'action' => 'delete'))), 'api_admin_update' => array('type' => 'segment', 'options' => array('route' => '/admin/api/update/[:code]', 'defaults' => array('__NAMESPACE__' => 'RefPays\\Controller', 'controller' => 'Admin', 'action' => 'PaysUpdate'))), 'api_admin_create' => array('type' => 'segment', 'options' => array('route' => '/admin/api/create', 'defaults' => array('__NAMESPACE__' => 'RefPays\\Controller', 'controller' => 'Admin', 'action' => 'PaysCreate'))))), 'service_manager' => array('abstract_factories' => array('Zend\\Cache\\Service\\StorageCacheAbstractServiceFactory', 'Zend\\Log\\LoggerAbstractServiceFactory'), 'factories' => array('translator' => 'Zend\\Mvc\\Service\\TranslatorServiceFactory', 'pays-table' => function ($sm) {
    $tableGateway = $sm->get('pays-table-gateway');
    $table = new \RefPays\Model\PaysTable($tableGateway);
    return $table;
}, 'pays-table-gateway' => function ($sm) {
    $dbAdapter = $sm->get('Zend\\db\\Adapter\\Adapter');
    $resultSetPrototype = new \Zend\Db\ResultSet\ResultSet();
    $resultSetPrototype->setArrayObjectPrototype(new \RefPays\Model\Pays());
    return new \Zend\Db\TableGateway\TableGateway('pays', $dbAdapter, null, $resultSetPrototype);
})), 'translator' => array('locale' => 'en_US', 'translation_file_patterns' => array(array('type' => 'gettext', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.mo'))), 'controllers' => array('invokables' => array('RefPays\\Controller\\Index' => 'RefPays\\Controller\\IndexController', 'RefPays\\Controller\\Api' => 'RefPays\\Controller\\ApiController', 'RefPays\\Controller\\Admin' => 'RefPays\\Controller\\AdminController')), 'view_manager' => array('display_not_found_reason' => true, 'display_exceptions' => true, 'doctype' => 'HTML5', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_map' => array('layout/layout' => __DIR__ . '/../view/layout/layout.phtml', 'layout/error' => __DIR__ . '/../view/layout/error.phtml', 'ref-pays/index/index' => __DIR__ . '/../view/ref-pays/index/index.phtml', 'ref-pays/api/index' => __DIR__ . '/../view/ref-pays/api/index.phtml', 'error/404' => __DIR__ . '/../view/error/404.phtml', 'error/index' => __DIR__ . '/../view/error/index.phtml'), 'template_path_stack' => array(__DIR__ . '/../view'), 'strategies' => array('ViewJsonStrategy')), 'console' => array('router' => array('routes' => array())));