本文整理汇总了PHP中Zend\Db\ResultSet\ResultSet::setArrayObjectPrototype方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultSet::setArrayObjectPrototype方法的具体用法?PHP ResultSet::setArrayObjectPrototype怎么用?PHP ResultSet::setArrayObjectPrototype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\ResultSet\ResultSet
的用法示例。
在下文中一共展示了ResultSet::setArrayObjectPrototype方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getServiceConfig
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);
}));
}
示例2: getServiceConfig
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);
}));
}
示例3: getServiceConfig
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);
}));
}
示例4: getServiceConfig
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);
}));
}
示例5: getServiceConfig
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;
}));
}
示例6: getServiceConfig
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);
}));
}
示例7: getUsersAndAbove
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);
}
示例8: fetchAll
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;
}
示例9: getServiceConfig
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);
}));
}
示例10: getGateway
/**
* @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;
}
示例11: createService
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);
}
示例12: __construct
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);
}
示例13: getServiceConfig
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);
}));
}
示例14: getServiceConfig
/**
* 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;
}]];
}
示例15: createService
public function createService(ServiceLocatorInterface $sm)
{
$dbAdapter = $sm->get('db-adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new Country());
return new TableGateway("pays", $dbAdapter, null, $resultSetPrototype);
}