当前位置: 首页>>代码示例>>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;未经允许,请勿转载。