本文整理汇总了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;
}
示例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');
}
示例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();
}
示例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']);
}
示例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'];
}
示例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);
}
示例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;
}
示例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);
}
示例9: getTable
protected function getTable()
{
return $this->tableGateway->getTable();
}
示例10: getAll
public function getAll()
{
$select = new \Zend\Db\Sql\Select();
$select->from($this->tableGateway->getTable());
return $select;
}
示例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');
}