Example #1
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\LoginTable' => function ($sm) {
         $loginGateway = $sm->get('LoginTableGateway');
         $table = new LoginTable($loginGateway);
         return $table;
     }, 'LoginTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetProtype = new ResultSet();
         $resultSetProtype->setArrayObjectPrototype(new Login());
         return new TableGateway('login', $dbAdapter, null, $resultSetProtype);
     }, 'Application\\Model\\PortfolioTable' => function ($sm) {
         $portfolioGateway = $sm->get('PortfolioTableGateway');
         $table = new PortfolioTable($portfolioGateway);
         return $table;
     }, 'PortfolioTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetProtype = new ResultSet();
         $resultSetProtype->setArrayObjectPrototype(new Portfolio());
         return new TableGateway('portfolio', $dbAdapter, null, $resultSetProtype);
     }, 'Application\\Model\\FotosTable' => function ($sm) {
         $fotosGateway = $sm->get('FotosTableGateway');
         $table = new FotosTable($fotosGateway);
         return $table;
     }, 'FotosTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetProtype = new ResultSet();
         $resultSetProtype->setArrayObjectPrototype(new Fotos());
         return new TableGateway('fotos', $dbAdapter, null, $resultSetProtype);
     }));
 }
Example #2
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\KategorieTable' => function ($sm) {
         $tableGateway = $sm->get('KategorieTableGateway');
         $table = new KategorieTable($tableGateway);
         return $table;
     }, 'KategorieTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Kategorie());
         return new TableGateway('kategorie', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\UserTable' => function ($sm) {
         $tableGateway = $sm->get('UserTableGateway');
         $table = new UserTable($tableGateway);
         return $table;
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('uzivatele', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\BannerTable' => function ($sm) {
         $tableGateway = $sm->get('BannerTableGateway');
         $table = new BannerTable($tableGateway);
         return $table;
     }, 'BannerTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Banner());
         return new TableGateway('banner', $dbAdapter, null, $resultSetPrototype);
     }));
 }
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\StateTable' => function ($sm) {
         $tableGateway = $sm->get('StateTableGateway');
         $table = new StateTable($tableGateway);
         return $table;
     }, 'StateTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new State());
         return new TableGateway(DB_PREFIX . 'state', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\CityTable' => function ($sm) {
         $tableGateway = $sm->get('CityTableGateway');
         $table = new CityTable($tableGateway);
         return $table;
     }, 'CityTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new City());
         return new TableGateway(DB_PREFIX . 'city', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\PostMerchandiseTable' => function ($sm) {
         $tableGateway = $sm->get('PostMerchandiseTableGateway');
         $table = new PostMerchandiseTable($tableGateway);
         return $table;
     }, 'PostMerchandiseTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Post());
         return new TableGateway(DB_PREFIX . 'post_merchandise', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #4
0
 public function getServiceConfig()
 {
     return array('factories' => array('Usuario\\Model\\UsuarioTable' => function ($sm) {
         $tableGateway = $sm->get('UsuarioTableGateway');
         $table = new UsuarioTable($tableGateway);
         return $table;
     }, 'UsuarioTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Usuario());
         return new TableGateway('ta_usuario', $dbAdapter, null, $resultSetPrototype);
     }, 'Usuario\\Model\\Cliente' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $table = new Cliente($dbAdapter);
         return $table;
     }, 'Usuario\\Model\\ComentariosTable' => function ($sm) {
         $tableGateway = $sm->get('ComentariosTableGateway');
         $table = new Model\ComentariosTable($tableGateway);
         return $table;
     }, 'ComentariosTableGateway' => function ($sm) {
         $dbAdapte = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Comentarios());
         return new TableGateway('ta_comentario', $dbAdapte, null, $resultSetPrototype);
     }, 'Usuario\\Model\\ClientesTable' => function ($sm) {
         $tableGateway = $sm->get('ClientesTableGateway');
         $table = new Model\ClientesTable($tableGateway);
         return $table;
     }, 'ClientesTableGateway' => function ($sm) {
         $dbAdapte = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Clientes());
         return new TableGateway('ta_cliente', $dbAdapte, null, $resultSetPrototype);
     }));
 }
Example #5
0
 public function getServiceConfig()
 {
     return array('initializers' => array(function ($instance, $sm) {
         if ($instance instanceof \Zend\Db\Adapter\AdapterAwareInterface) {
             $instance->setDbAdapter($sm->get('Zend\\Db\\Adapter\\Adapter'));
         }
     }), 'factories' => array('InvoiceTable' => function ($sm) {
         $tableGateway = $sm->get('InvoiceTableGateway');
         $table = new InvoiceTable($tableGateway);
         return $table;
     }, 'InvoiceTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Invoice());
         return new TableGateway('invoice', $dbAdapter, null, $resultSetPrototype);
     }, 'Invoice\\Model\\OderTable' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $table = new OderTable($dbAdapter);
         return $table;
     }, 'Invoice\\Model\\OderdetailTable' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $table = new OderdetailTable($dbAdapter);
         return $table;
     }));
 }
Example #6
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\PaymentTable' => function ($sm) {
         $tableGateway = $sm->get('PaymentTableGateway');
         $table = new PaymentTable($tableGateway);
         return $table;
     }, 'PaymentTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Payment());
         return new TableGateway('payments_history', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\HuntClubTable' => function ($sm) {
         $tableGateway = $sm->get('HuntClubTableGateway');
         $table = new HuntClubTable($tableGateway);
         return $table;
     }, 'HuntClubTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new HuntClub());
         return new TableGateway('hunt_clubs', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\HuntClubGameTable' => function ($sm) {
         $tableGateway = $sm->get('HuntClubGameTableGateway');
         $table = new HuntClubGameTable($tableGateway);
         return $table;
     }, 'HuntClubGameTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new HuntClubGame());
         return new TableGateway('hunt_club_game', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #7
0
 public function getUsersAndAbove(bool $paginated, $name = '', $roles = [])
 {
     $select = new Select('account');
     $where = new Where();
     if ($roles) {
         $sub = $where->nest();
         for ($i = 0; $i < count($roles); $i++) {
             $sub->equalTo('role', $roles[$i]);
             if ($i < count($roles) - 1) {
                 $sub->or;
             }
         }
         $sub->unnest();
     } else {
         $where->greaterThan('role', '0');
         $where->lessThan('role', '32');
     }
     if ($name) {
         $where->like('name', '%' . $name . '%');
     }
     $select->where($where)->order('name ASC');
     if ($paginated) {
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Account());
         $paginatorAdapter = new DbSelect($select, $this->tableGateway->getAdapter(), $resultSetPrototype);
         return new Paginator($paginatorAdapter);
     }
     return $this->tableGateway->select($select);
 }
Example #8
0
 public function fetchAll($request, $paginated = false)
 {
     if ($paginated) {
         // create a new Select object for the table album
         $select = new Select('album');
         $select->order($request['sort'] . " " . $request['order']);
         // Search
         if ($request['search']) {
             $x = $request['search'] . '%';
             $where = new \Zend\Db\Sql\Where();
             $where->like('title', $x);
             $where->or->like('artist', $x);
             $select->where($where);
         }
         // New result set based on the Album entity
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Album());
         // New pagination adapter object
         $paginatorAdapter = new DbSelect($select, $this->tableGateway->getAdapter(), $resultSetPrototype);
         $paginator = new Paginator($paginatorAdapter);
         return $paginator;
     }
     $resultSet = $this->tableGateway->select();
     return $resultSet;
 }
Example #9
0
 public function getServiceConfig()
 {
     return array('factories' => array('Forum\\Model\\ThreadList' => function ($sm) {
         $tableGateway = $sm->get('ThreadListGateway');
         $table = new ThreadList($tableGateway);
         return $table;
     }, 'ThreadListGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Thread());
         return new TableGateway('forum', $dbAdapter, null, $resultSetPrototype);
     }, 'Forum\\Model\\PostList' => function ($sm) {
         $tableGateway = $sm->get('PostListGateway');
         $table = new PostList($tableGateway);
         return $table;
     }, 'PostListGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Post());
         return new TableGateway('posts', $dbAdapter, null, $resultSetPrototype);
     }, 'Forum\\Model\\UserList' => function ($sm) {
         $tableGateway = $sm->get('UserListGateway');
         $table = new UserList($tableGateway);
         return $table;
     }, 'UserListGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
     }));
 }
 /**
  * @param string             $name
  * @param DataModelInterface $model
  *
  * @return null|MongoGateway
  * @throws \Exception
  */
 public function getGateway($name, DataModelInterface $model = null)
 {
     if ($model == null) {
         throw new \Exception(' Raw Gateway needs a DataModelInterface instance as the second parameter ');
     }
     $adapterConfig = $this->getConfig($model);
     $gwName = Arr::getDoubtField($adapterConfig, 'gateway', null);
     if ($gwName === null) {
         $gwName = Arr::getDoubtField($adapterConfig, 'driver', null);
     }
     if ($gwName === null) {
         throw new \Exception('Unknown gateway');
     }
     // create resultSet prototype
     $resultSetPrototype = new ResultSet();
     $resultSetPrototype->setArrayObjectPrototype($model);
     // create custom transport for the model
     $dbAdapter = $this->getServiceLocator()->get($model->_adapter);
     // use general gw class
     if ($gwName == 'Pdo') {
         throw new \Exception(' TODO: Needs to implement PDO Gateway create !! ');
     }
     $gw = Obj::create('\\ModelFramework\\GatewayService\\MongoGateway', ['table' => $model->getTableName(), 'adapter' => $dbAdapter, 'resultSetPrototype' => $resultSetPrototype]);
     return $gw;
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $dbAdapter = $serviceLocator->get('Zend\\Db\\Adapter\\Adapter');
     $resultSetPrototype = new ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new Product());
     return new TableGateway('table_product', $dbAdapter, null, $resultSetPrototype);
 }
Example #12
0
 public function getServiceConfig()
 {
     return array('factories' => array('Admin\\Model\\AdminTable' => function ($sm) {
         $tableGateway = $sm->get('AdminTableGateway');
         $table = new AdminTable($tableGateway);
         return $table;
     }, 'AdminTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Admin());
         return new TableGateway('admin', $dbAdapter, null, $resultSetPrototype);
     }, 'Admin\\Model\\PlayerTable' => function ($sm) {
         $tableGateway = $sm->get('PlayerTableGateway');
         $table = new PlayerTable($tableGateway);
         return $table;
     }, 'PlayerTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Player());
         return new TableGateway('player', $dbAdapter, null, $resultSetPrototype);
     }, 'Admin\\Model\\MyAuthStorage' => function ($sm) {
         return new \Admin\Model\MyAuthStorage('adminstore');
     }, 'AuthService' => function ($sm) {
         //My assumption, you've alredy set dbAdapter
         //and has users table with columns : user_name and pass_word
         //that password hashed with md5
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $dbTableAuthAdapter = new DbTableAuthAdapter($dbAdapter, 'admin', 'email', 'password', 'MD5(?)');
         $authService = new AuthenticationService();
         $authService->setAdapter($dbTableAuthAdapter);
         $authService->setStorage($sm->get('Admin\\Model\\MyAuthStorage'));
         return $authService;
     }));
 }
Example #13
0
 public function __construct(DBEntity $object, AdapterInterface $adapter, $features = null)
 {
     $this->object = $object;
     $resultSetPrototype = new ResultSet();
     $resultSetPrototype->setArrayObjectPrototype($object);
     parent::__construct($object->getTableName(), $adapter, $features, $resultSetPrototype);
 }
Example #14
0
 public function getServiceConfig()
 {
     return array('factories' => array('Pizza\\Model\\PizzaTable' => function ($sm) {
         $tableGateway = $sm->get('PizzaTableGateway');
         $table = new PizzaTable($tableGateway);
         return $table;
     }, 'PizzaTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Pizza());
         return new TableGateway('pizza', $dbAdapter, null, $resultSetPrototype);
     }, 'Pizza\\Model\\SandwichTable' => function ($sm) {
         $tableGateway = $sm->get('SandwichTableGateway');
         $table = new SandwichTable($tableGateway);
         return $table;
     }, 'SandwichTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Sandwich());
         return new TableGateway('sandwich', $dbAdapter, null, $resultSetPrototype);
     }, 'Pizza\\Model\\DrinkTable' => function ($sm) {
         $tableGateway = $sm->get('DrinkTableGateway');
         $table = new DrinkTable($tableGateway);
         return $table;
     }, 'DrinkTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Drink());
         return new TableGateway('drink', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #15
0
 /**
  * Expected to return \Zend\ServiceManager\Config object or array to
  * seed such an object.
  *
  * @return array|\Zend\ServiceManager\Config
  */
 public function getServiceConfig()
 {
     return ['factories' => ['ArticleTable' => function (ServiceLocatorInterface $sm) {
         $tableGateway = $sm->get('ArticleTableGateway');
         $table = new ArticleTable($tableGateway);
         return $table;
     }, 'ArticleTableGateway' => function (ServiceLocatorInterface $sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Article());
         return new TableGateway('tbl_article', $dbAdapter, null, $resultSetPrototype);
     }, 'UserTable' => function (ServiceLocatorInterface $sm) {
         $tableGateway = $sm->get('UserTableGateway');
         $table = new UserTable($tableGateway);
         return $table;
     }, 'UserTableGateway' => function (ServiceLocatorInterface $sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('tbl_user', $dbAdapter, null, $resultSetPrototype);
     }, 'Smarty' => function (ServiceLocatorInterface $sm) {
         $smarty = new MySmarty();
         $smarty->debugging = false;
         $smarty->caching = false;
         $smarty->cache_lifetime = 120;
         $smarty->setTemplateDir(__DIR__ . '/view/smarty/templates');
         $smarty->setConfigDir(__DIR__ . '/view/smarty/configs');
         $smarty->setCompileDir(__DIR__ . '/view/smarty/templates_c');
         $smarty->setCacheDir(__DIR__ . '/view/smarty/cache');
         return $smarty;
     }]];
 }
 public function createService(ServiceLocatorInterface $sm)
 {
     $dbAdapter = $sm->get('db-adapter');
     $resultSetPrototype = new ResultSet();
     $resultSetPrototype->setArrayObjectPrototype(new Country());
     return new TableGateway("pays", $dbAdapter, null, $resultSetPrototype);
 }
Example #17
0
 public function getServiceConfig()
 {
     return array('factories' => array('User\\Model\\UserTable' => function ($sm) {
         $tableGateway = $sm->get('UserTableGateway');
         $table = new UserTable($tableGateway);
         return $table;
     }, 'UserTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('user', $dbAdapter, null, $resultSetPrototype);
     }, 'User\\Model\\CityTable' => function ($sm) {
         $tableGateway = $sm->get('CityTableGateway');
         $table = new CityTable($tableGateway);
         return $table;
     }, 'CityTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new City());
         return new TableGateway('city', $dbAdapter, null, $resultSetPrototype);
     }, 'User\\Model\\EducationTable' => function ($sm) {
         $tableGateway = $sm->get('EducationTableGateway');
         $table = new EducationTable($tableGateway);
         return $table;
     }, 'EducationTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Education());
         return new TableGateway('educations', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #18
0
 public function fetchAll($paginate = true, $Flag = false, $user_id = '')
 {
     if ($paginate) {
         $select = new Select('messages');
         $select->columns(array('*', new Expression("from_user.user_name as from_user, to_user.user_name as to_user")));
         $select->join(array('from_user' => 'users'), 'from_user.id = messages.from_user_id', array(), 'left');
         $select->join(array('to_user' => 'users'), 'to_user.id = messages.to_user_id', array(), 'left');
         if ($Flag == "trash") {
             $select->where(array('deleteFlag' => '1'));
             $select->order('created_date ASC');
         } else {
             if ($Flag == "outbox") {
                 $select->where(array('from_user_id' => $user_id, 'deleteFlag' => '0'));
                 $select->order('created_date ASC');
             } else {
                 if ($Flag == "inbox") {
                     $select->where('to_user_id = ' . $user_id . ' AND deleteFlag = 0');
                     $select->order('created_date ASC');
                 }
             }
         }
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Messages());
         $paginatorAdapter = new DbSelect($select, $this->tableGateway->getAdapter(), $resultSetPrototype);
         $paginator = new Paginator($paginatorAdapter);
         return $paginator;
     }
     return $this->tableGateway->select();
 }
Example #19
0
 public function getServiceConfig()
 {
     return array('factories' => array('Api\\Model\\GroupsTable' => function ($sm) {
         $tableGateway = $sm->get('GroupsTableGateway');
         $table = new GroupsTable($tableGateway);
         return $table;
     }, 'GroupsTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Group());
         return new TableGateway('groups', $dbAdapter, null, $resultSetPrototype);
     }, 'Api\\Model\\UsersTable' => function ($sm) {
         $tableGateway = $sm->get('UsersTableGateway');
         $table = new UsersTable($tableGateway);
         return $table;
     }, 'UsersTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new User());
         return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
     }, 'Api\\Model\\UsersToGroupsTable' => function ($sm) {
         $tableGateway = $sm->get('UsersToGroupsTableGateway');
         $table = new UsersToGroupsTable($tableGateway);
         return $table;
     }, 'UsersToGroupsTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new UserToGroup());
         return new TableGateway('users_to_groups', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #20
0
 public function getServiceConfig()
 {
     return ['factories' => ['MailOptions' => 'Base\\Service\\Factory\\MailOptions', 'CommunityTable' => function (ServiceLocatorInterface $sm) {
         $tableGateway = $sm->get('CommunityTableGateway');
         $table = new CommunityTable($tableGateway);
         return $table;
     }, 'CommunityTableGateway' => function (ServiceLocatorInterface $sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Community());
         return new TableGateway('tbl_community', $dbAdapter, null, $resultSetPrototype);
     }, 'ReleaseOrderTable' => function (ServiceLocatorInterface $sm) {
         $tableGateway = $sm->get('ReleaseOrderTableGateway');
         $table = new ReleaseOrderTable($tableGateway);
         return $table;
     }, 'ReleaseOrderTableGateway' => function (ServiceLocatorInterface $sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new ReleaseOrder());
         return new TableGateway('tbl_release_order', $dbAdapter, null, $resultSetPrototype);
     }, 'YqClassTable' => function (ServiceLocatorInterface $sm) {
         $tableGateway = $sm->get('YqClassTableGateway');
         $table = new YqClassTable($tableGateway);
         return $table;
     }, 'YqClassTableGateway' => function (ServiceLocatorInterface $sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new YqClass());
         return new TableGateway('tbl_yq_class', $dbAdapter, null, $resultSetPrototype);
     }, 'redis-cli' => 'Base\\Service\\Factory\\RedisFactory'], 'invokables' => ['LongDai' => 'Base\\Service\\LongDaiService']];
 }
Example #21
0
 public function getServiceConfig()
 {
     return array('initializers' => array(function ($instance, $sm) {
         if ($instance instanceof \Zend\Db\Adapter\AdapterAwareInterface) {
             $instance->setDbAdapter($sm->get('Zend\\Db\\Adapter\\Adapter'));
         }
     }), 'factories' => array('ProductTable' => function ($sm) {
         $tableGateway = $sm->get('ProductTableGateway');
         $table = new ProductTable($tableGateway);
         return $table;
     }, 'ProductTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Product());
         return new TableGateway('product', $dbAdapter, null, $resultSetPrototype);
     }, 'NameTable' => function ($sm) {
         $tableGateway = $sm->get('NameTableGateway');
         $table = new NameTable($tableGateway);
         return $table;
     }, 'NameTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Name());
         return new TableGateway('name', $dbAdapter, null, $resultSetPrototype);
     }, 'DeclarationTable' => function ($sm) {
         $tableGateway = $sm->get('DeclarationTableGateway');
         $table = new DeclarationTable($tableGateway);
         return $table;
     }, 'DeclarationTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Declaration());
         return new TableGateway('declaration', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #22
0
 public function getServiceConfig()
 {
     return array('factories' => array('Myworkapp\\Model\\TaskTable' => function ($sm) {
         $tableGateway = $sm->get('TaskTableGateway');
         $table = new TaskTable($tableGateway);
         return $table;
     }, 'TaskTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Task());
         return new TableGateway('tasks', $dbAdapter, null, $resultSetPrototype);
     }, 'Myworkapp\\Model\\TaskTypeTable' => function ($sm) {
         $tableGateway = $sm->get('TaskTypeTableGateway');
         $table = new TaskTypeTable($tableGateway);
         return $table;
     }, 'TaskTypeTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new TaskType());
         return new TableGateway('task_types', $dbAdapter, null, $resultSetPrototype);
     }, 'Myworkapp\\Model\\EmployeeTable' => function ($sm) {
         $tableGateway = $sm->get('EmployeeTableGateway');
         $table = new EmployeeTable($tableGateway);
         return $table;
     }, 'EmployeeTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Employee());
         return new TableGateway('employers', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #23
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\CertificateTable' => function ($sm) {
         $tableGateway = $sm->get('CertificateTableGateway');
         $table = new CertificateTable($tableGateway);
         return $table;
     }, 'CertificateTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new TableGateway('certificates', $dbAdapter);
     }, 'Application\\Model\\DocumentTable' => function ($sm) {
         $tableGateway = $sm->get('DocumentTableGateway');
         $table = new DocumentTable($tableGateway);
         return $table;
     }, 'DocumentTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Document());
         return new TableGateway('documents', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\PriceHistoryTable' => function ($sm) {
         $tableGateway = $sm->get('PriceHistoryTableGateway');
         $table = new PriceHistoryTable($tableGateway);
         return $table;
     }, 'PriceHistoryTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new PriceHistory());
         return new TableGateway('price_history', $dbAdapter, null, $resultSetPrototype);
     }));
 }
 public function fetchAll($paginate = true, $filter = array(), $orderBy = array())
 {
     if ($paginate) {
         $select = new Select('service_language');
         $select->join('lookup_status', 'lookup_status.status_id = service_language.status_id', array('status'), 'left');
         /* Data filter code start here*/
         if (count($filter) > 0) {
             $filter['language_name'] != "" ? $select->where("service_language.language_name LIKE '%" . $filter['language_name'] . "%'") : "";
             $filter['status_id'] != "" ? $select->where("service_language.status_id = " . $filter['status_id']) : "";
         }
         /* Data filter code end here*/
         /* Data sorting code starts here */
         if (count($orderBy) > 0 && $orderBy['sort_field'] != '' && $orderBy['sort_order'] != '') {
             switch ($orderBy['sort_field']) {
                 case 'language':
                     $select->order('service_language.language_name ' . $orderBy['sort_order']);
                     break;
                 case 'status':
                     $select->order('lookup_status.status ' . $orderBy['sort_order']);
                     break;
             }
         }
         /* Data sorting code ends here */
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new ServiceLanguages());
         $paginatorAdapter = new DbSelect($select, $this->tableGateway->getAdapter(), $resultSetPrototype);
         $paginator = new Paginator($paginatorAdapter);
         return $paginator;
     }
     return $this->tableGateway->select();
 }
 protected function setUp()
 {
     $bootstrap = \Zend\Mvc\Application::init(include 'config/application.config.php');
     $categoryData = array('id_category' => 1, 'name' => 'Project Manager');
     $category = new Category();
     $category->exchangeArray($categoryData);
     $resultSetCategory = new ResultSet();
     $resultSetCategory->setArrayObjectPrototype(new Category());
     $resultSetCategory->initialize(array($category));
     $mockCategoryTableGateway = $this->getMock('Zend\\Db\\TableGateway\\TableGateway', array('select'), array(), '', false);
     $mockCategoryTableGateway->expects($this->any())->method('select')->with()->will($this->returnValue($resultSetCategory));
     $categoryTable = new CategoryTable($mockCategoryTableGateway);
     $jobData = array('id_job' => 1, 'id_category' => 1, 'type' => 'typeTest', 'company' => 'companyTest', 'logo' => 'logoTest', 'url' => 'urlTest', 'position' => 'positionTest', 'location' => 'locaitonTest', 'description' => 'descriptionTest', 'how_to_play' => 'hotToPlayTest', 'is_public' => 1, 'is_activated' => 1, 'email' => 'emailTest', 'created_at' => '2012-01-01 00:00:00', 'updated_at' => '2012-01-01 00:00:00');
     $job = new Job();
     $job->exchangeArray($jobData);
     $resultSetJob = new ResultSet();
     $resultSetJob->setArrayObjectPrototype(new Job());
     $resultSetJob->initialize(array($job));
     $mockJobTableGateway = $this->getMock('Zend\\Db\\TableGateway\\TableGateway', array('select'), array(), '', false);
     $mockJobTableGateway->expects($this->any())->method('select')->with(array('id_category' => 1))->will($this->returnValue($resultSetJob));
     $jobTable = new JobTable($mockJobTableGateway);
     $this->controller = new IndexController($categoryTable, $jobTable);
     $this->request = new Request();
     $this->routeMatch = new RouteMatch(array('controller' => 'index'));
     $this->event = $bootstrap->getMvcEvent();
     $this->event->setRouteMatch($this->routeMatch);
     $this->controller->setEvent($this->event);
     $this->controller->setEventManager($bootstrap->getEventManager());
     $this->controller->setServiceLocator($bootstrap->getServiceManager());
 }
 public function __construct($db)
 {
     $this->db = $db;
     $resultSet = new ResultSet();
     $resultSet->setArrayObjectPrototype(new ClienteEntity());
     $this->tableGateway = new TableGateway('Cliente', $db, null, $resultSet);
 }
Example #27
0
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $subject = $serviceLocator->get('Category\\Model\\Category');
     $resultSet = new ResultSet();
     $resultSet->setArrayObjectPrototype($subject);
     return $resultSet;
 }
Example #28
0
 public function getServiceConfig()
 {
     return array('factories' => array('StitchPattern\\Model\\StitchPatternTable' => function ($sm) {
         $tableGateway = $sm->get('StitchPatternTableGateway');
         $table = new StitchPatternTable($tableGateway);
         return $table;
     }, 'StitchPatternTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new StitchPattern());
         return new TableGateway('stitchpattern', $dbAdapter, null, $resultSetPrototype);
     }, 'StitchPattern\\Model\\EmulatorBridge' => function ($sm) {
         $emulator = new EmulatorBridge();
         return $emulator;
     }, 'StitchPattern\\Model\\USBCableTable' => function ($sm) {
         $tableGateway = $sm->get('USBCableTableGateway');
         $table = new USBCableTable($tableGateway);
         return $table;
     }, 'USBCableTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new USBCable());
         return new TableGateway('usbcable', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #29
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\BookTable' => function ($sm) {
         $tableGateway = $sm->get('BookTableGateway');
         $table = new BookTable($tableGateway);
         return $table;
     }, 'BookTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Book());
         return new TableGateway('books', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\GenreTable' => function ($sm) {
         $tableGateway = $sm->get('GenreTableGateway');
         $table = new GenreTable($tableGateway);
         return $table;
     }, 'GenreTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Genre());
         return new TableGateway('genres', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\AuthorTable' => function ($sm) {
         $tableGateway = $sm->get('AuthorTableGateway');
         $table = new AuthorTable($tableGateway);
         return $table;
     }, 'AuthorTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Author());
         return new TableGateway('authors', $dbAdapter, null, $resultSetPrototype);
     }));
 }
Example #30
0
 public function getServiceConfig()
 {
     return array('factories' => array('Application\\Model\\LoginTable' => function ($sm) {
         $tableGateway = $sm->get('LoginTableGateway');
         $table = new LoginTable($tableGateway);
         return $table;
     }, 'LoginTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Login());
         return new TableGateway('users', $dbAdapter, null, $resultSetPrototype);
     }, 'Application\\Model\\JobsTable' => function ($sm) {
         $tableGateway = $sm->get('JobsTableGateway');
         $table = new JobsTable($tableGateway);
         return $table;
     }, 'JobsTableGateway' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $resultSetPrototype = new ResultSet();
         $resultSetPrototype->setArrayObjectPrototype(new Job());
         return new TableGateway('jobs', $dbAdapter, null, $resultSetPrototype);
     }, 'LoginAuthAdapter' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         return new AuthAdapter($dbAdapter, 'users', 'username', 'password');
     }, 'AuthStatus' => function ($sm) {
         $dbAdapter = $sm->get('Zend\\Db\\Adapter\\Adapter');
         $authAdapter = new AuthAdapter($dbAdapter, 'users', 'username', 'password');
         $authStatus = new AuthenticationService();
         $authStatus->setAdapter($authAdapter);
         return $authStatus;
     }));
 }