當前位置: 首頁>>代碼示例>>PHP>>正文


PHP TableGateway::getResultSetPrototype方法代碼示例

本文整理匯總了PHP中Zend\Db\TableGateway\TableGateway::getResultSetPrototype方法的典型用法代碼示例。如果您正苦於以下問題:PHP TableGateway::getResultSetPrototype方法的具體用法?PHP TableGateway::getResultSetPrototype怎麽用?PHP TableGateway::getResultSetPrototype使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Db\TableGateway\TableGateway的用法示例。


在下文中一共展示了TableGateway::getResultSetPrototype方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: doUpdateModel

 /**
  * {@inheritDoc}
  */
 protected function doUpdateModel($model)
 {
     if ($id = $this->getModelId($model)) {
         $this->tableGateway->update($this->tableGateway->getResultSetPrototype()->getHydrator()->extract($model), array("{$this->idField} = ?" => $id));
     } else {
         $this->tableGateway->insert($this->tableGateway->getResultSetPrototype()->getHydrator()->extract($model));
     }
 }
開發者ID:stan5621,項目名稱:eduwind,代碼行數:11,代碼來源:TableGatewayStorage.php

示例2: selectMany

 /**
  * @param  Select             $select
  * @param  array              $options   Paginator options
  * @param  ResultSetInterface $resultSet
  * @return array|Paginator
  */
 public function selectMany(Select $select, array $options = array(), ResultSetInterface $resultSet = null)
 {
     if (!$resultSet) {
         $resultSet = $this->tableGateway->getResultSetPrototype();
     }
     if ($options) {
         return $this->initPaginator($select, $options, $resultSet);
     }
     return $this->tableGateway->selectWith($select, $resultSet);
 }
開發者ID:sydnerdrage,項目名稱:sample-service,代碼行數:16,代碼來源:AbstractMapper.php

示例3: __construct

 /**
  * Constructs instance.
  *
  * @param TableGateway                $tableGateway
  * @param Where|\Closure|string|array $where
  * @param null                        $order
  */
 public function __construct(TableGateway $tableGateway, $where = null, $order = null)
 {
     $select = $tableGateway->getSql()->select();
     if ($where) {
         $select->where($where);
     }
     if ($order) {
         $select->order($order);
     }
     $dbAdapter = $tableGateway->getAdapter();
     $resultSetPrototype = $tableGateway->getResultSetPrototype();
     parent::__construct($select, $dbAdapter, $resultSetPrototype);
 }
開發者ID:idwsdta,項目名稱:INIT-frame,代碼行數:20,代碼來源:DbTableGateway.php

示例4: __construct

 /**
  * Constructs instance.
  *
  * @param TableGateway                      $tableGateway
  * @param null|Where|\Closure|string|array  $where
  * @param null|string|array                 $order
  * @param null|string|array                 $group
  * @param null|Having|\Closure|string|array $having
  */
 public function __construct(TableGateway $tableGateway, $where = null, $order = null, $group = null, $having = null)
 {
     $sql = $tableGateway->getSql();
     $select = $sql->select();
     if ($where) {
         $select->where($where);
     }
     if ($order) {
         $select->order($order);
     }
     if ($group) {
         $select->group($group);
     }
     if ($having) {
         $select->having($having);
     }
     $resultSetPrototype = $tableGateway->getResultSetPrototype();
     parent::__construct($select, $sql, $resultSetPrototype);
 }
開發者ID:liuxuezhan,項目名稱:my_tool,代碼行數:28,代碼來源:DbTableGateway.php

示例5: test__construct

 public function test__construct()
 {
     // constructor with only required args
     $table = new TableGateway('foo', $this->mockAdapter);
     $this->assertEquals('foo', $table->getTable());
     $this->assertSame($this->mockAdapter, $table->getAdapter());
     $this->assertInstanceOf('Zend\\Db\\TableGateway\\Feature\\FeatureSet', $table->getFeatureSet());
     $this->assertInstanceOf('Zend\\Db\\ResultSet\\ResultSet', $table->getResultSetPrototype());
     $this->assertInstanceOf('Zend\\Db\\Sql\\Sql', $table->getSql());
     // injecting all args
     $table = new TableGateway('foo', $this->mockAdapter, $featureSet = new Feature\FeatureSet(), $resultSet = new ResultSet(), $sql = new Sql($this->mockAdapter, 'foo'));
     $this->assertEquals('foo', $table->getTable());
     $this->assertSame($this->mockAdapter, $table->getAdapter());
     $this->assertSame($featureSet, $table->getFeatureSet());
     $this->assertSame($resultSet, $table->getResultSetPrototype());
     $this->assertSame($sql, $table->getSql());
     // constructor expects exception
     $this->setExpectedException('Zend\\Db\\TableGateway\\Exception\\InvalidArgumentException', 'Table name must be a string or an instance of Zend\\Db\\Sql\\TableIdentifier');
     new TableGateway(null, $this->mockAdapter);
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:20,代碼來源:TableGatewayTest.php

示例6: __invoke

 /**
  * {@inheritdoc}
  */
 public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
 {
     $config = $this->config[$requestedName];
     $dbAdapter = $container->get(isset($config['adapter']) ? $config['adapter'] : 'db');
     if (isset($config['schema'])) {
         $config['table'] = new TableIdentifier($config['table'], $config['schema']);
     }
     $featureSet = new FeatureSet();
     $featureSet->addFeature(new CommonCallFeature($config['primary']));
     if (isset($config['invokable'])) {
         $config['class'] = $config['invokable'];
     }
     if (isset($config['class'])) {
         if (!class_exists($config['class'])) {
             throw new \RuntimeException("Class '{$config['class']}' not found ");
         }
         /** @var \Zend\Db\TableGateway\TableGateway $table */
         $table = new $config['class']($config['table'], $dbAdapter, $featureSet);
     } else {
         $table = new TableGateway($config['table'], $dbAdapter, $featureSet);
     }
     if (isset($config['row'])) {
         if ($config['row'] === true) {
             $config['row'] = 'Zend\\Db\\RowGateway\\RowGateway';
         }
         if (is_string($config['row'])) {
             if (!class_exists($config['row'])) {
                 throw new \RuntimeException("Class '{$config['row']}' not found ");
             }
             $rowGatewayPrototype = new $config['row']($config['primary'], $config['table'], $dbAdapter, $table->getSql());
         } elseif (is_object($config['row'])) {
             $rowGatewayPrototype = $config['row'];
         } else {
             throw new \InvalidArgumentException('Error row argument');
         }
         $table->getResultSetPrototype()->setArrayObjectPrototype($rowGatewayPrototype);
     }
     return $table;
 }
開發者ID:zfegg,項目名稱:zend-db-feature,代碼行數:42,代碼來源:TableGatewayAbstractServiceFactory.php

示例7: fetchRawSql

 public function fetchRawSql($sql)
 {
     return $this->tableGateway->getResultSetPrototype()->set($this->executeRawSql($sql));
 }
開發者ID:sedpro,項目名稱:test_skyeng,代碼行數:4,代碼來源:Simple.php

示例8: getItemSetProto

 /**
  *
  * @return TableEntitySetInterface
  */
 public function getItemSetProto()
 {
     return $this->tableGateway->getResultSetPrototype();
 }
開發者ID:ponchov,項目名稱:teeforall,代碼行數:8,代碼來源:Simple.php


注:本文中的Zend\Db\TableGateway\TableGateway::getResultSetPrototype方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。