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


PHP TableGateway::getTable方法代碼示例

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


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

示例1: fetchAllPendingForThread

 /**
  * Returns all the comments pending approval for a thread.
  *
  * @param string $thread
  * @return ResultSet
  */
 public function fetchAllPendingForThread($thread)
 {
     $select = new Select($this->tableGateway->getTable());
     $select->columns(array('id', 'author', 'content', 'contact', 'published_on_raw' => 'published_on', 'published_on' => new Expression("DATE_FORMAT(published_on, '%M %d, %Y %H:%i')")))->where(array('thread' => $thread, 'visible' => 0))->order('published_on_raw ASC');
     $resultSet = $this->tableGateway->selectWith($select);
     return $resultSet;
 }
開發者ID:robertboloc,項目名稱:rbcomment,代碼行數:13,代碼來源:CommentTable.php

示例2: setUp

 protected function setUp()
 {
     parent::setUp();
     $tableGateway = $this->config['testDbTableMultiInsert']['tableGateway'];
     $this->dbTable = $this->container->get($tableGateway);
     $this->dbTableName = $this->dbTable->getTable();
     $this->adapter = $this->container->get('db');
     $this->object = $this->container->get('testDbTableMultiInsert');
 }
開發者ID:avz-cmf,項目名稱:zaboy-rest,代碼行數:9,代碼來源:DbTableMultiInsertTest.php

示例3: getCurrentVersion

 public function getCurrentVersion($mdir_md5)
 {
     $select = new Select($this->tableGateway->getTable());
     $select->where(array('mdir_md5' => $mdir_md5))->order('version DESC')->limit(1);
     $result = $this->tableGateway->selectWith($select);
     if (!$result->count()) {
         return 0;
     }
     return $result->current()->getVersion();
 }
開發者ID:ycheukf,項目名稱:migration,代碼行數:10,代碼來源:MigrationVersionTable.php

示例4: getRatingSet

 /**
  * Gets the set of ratings for the given type id.
  *
  * @param string $typeId The type identifier to get the set of ratings for.
  * @return RatingSet
  */
 public function getRatingSet($typeId)
 {
     $adapter = $this->gateway->getAdapter();
     $sql = new Sql($adapter);
     $select = $sql->select();
     $select->from($this->gateway->getTable());
     $select->columns(array('amount' => new Expression('COUNT(rating)'), 'avarage' => new Expression('AVG(rating)'), 'highest' => new Expression('MAX(rating)'), 'lowest' => new Expression('MIN(rating)')), false);
     $rowset = $this->gateway->selectWith($select);
     $row = $rowset->current();
     return new RatingSet($typeId, $row['amount'], $row['avarage'], $row['highest'], $row['lowest']);
 }
開發者ID:waltertamboer,項目名稱:wtrating,代碼行數:17,代碼來源:ZendDbMapper.php

示例5: count

 /**
  * {@inheritdoc}
  *
  * {@inheritdoc}
  */
 public function count()
 {
     $adapter = $this->dbTable->getAdapter();
     /* @var $rowset Zend\Db\ResultSet\ResultSet */
     $rowset = $adapter->query('SELECT COUNT(*) AS count FROM ' . $adapter->platform->quoteIdentifier($this->dbTable->getTable()), $adapter::QUERY_MODE_EXECUTE);
     return $rowset->current()['count'];
 }
開發者ID:avz-cmf,項目名稱:zaboy-res,代碼行數:12,代碼來源:DbTable.php

示例6: getRangeByKey

 /**
  * Returns EntitySet defined by $start and $stop range of key
  *
  * @param integer $start
  * @param integer $stop
  * @return TableEntitySetInterface
  */
 public function getRangeByKey($start, $stop)
 {
     $sql = new Sql($this->getAdapter());
     $select = $sql->select();
     $select->from($this->tableGateway->getTable());
     $select->where(new Predicate\Between($this->getItemSetProto()->getFactory()->getEntityProto()->getKeyName(), $start, $stop));
     return $this->tableGateway->selectWith($select);
 }
開發者ID:ponchov,項目名稱:teeforall,代碼行數:15,代碼來源:Simple.php

示例7: getSqlQuery

 public function getSqlQuery(Query $query)
 {
     $conditionBuilder = new SqlConditionBuilder($this->dbTable->getAdapter(), $this->dbTable->getTable());
     $selectSQL = $this->dbTable->getSql()->select();
     $selectSQL->where($conditionBuilder($query->getQuery()));
     $selectSQL = $this->setSelectOrder($selectSQL, $query);
     $selectSQL = $this->setSelectLimitOffset($selectSQL, $query);
     $selectSQL = $this->setSelectColumns($selectSQL, $query);
     $selectSQL = $this->setSelectJoin($selectSQL, $query);
     $selectSQL = $this->makeExternalSql($selectSQL);
     //build sql string
     $sql = $this->dbTable->getSql()->buildSqlString($selectSQL);
     //replace double ` char to single.
     $sql = str_replace(["`(", ")`", "``"], ['(', ')', "`"], $sql);
     return $sql;
 }
開發者ID:avz-cmf,項目名稱:zaboy-rest,代碼行數:16,代碼來源:DbTable.php

示例8: 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

示例9: getTable

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

示例10: getAll

 public function getAll()
 {
     $select = new \Zend\Db\Sql\Select();
     $select->from($this->tableGateway->getTable());
     return $select;
 }
開發者ID:Lebe1ge,項目名稱:JobeetForZF2,代碼行數:6,代碼來源:CategoryTable.php

示例11: testSelectWithWhereString

 /**
  * @covers Zend\Db\TableGateway\TableGateway::select
  * @covers Zend\Db\TableGateway\TableGateway::selectWith
  */
 public function testSelectWithWhereString()
 {
     $mockSelect = $this->mockSql->select();
     $mockSelect->expects($this->any())->method('getRawState')->will($this->returnValue(array('table' => $this->table->getTable())));
     // assert select::from() is called
     $mockSelect->expects($this->once())->method('where')->with($this->equalTo('foo'));
     $this->table->select('foo');
 }
開發者ID:rikaix,項目名稱:zf2,代碼行數:12,代碼來源:TableGatewayTest.php


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