本文整理汇总了PHP中Zend\Db\Sql\Sql::getTable方法的典型用法代码示例。如果您正苦于以下问题:PHP Sql::getTable方法的具体用法?PHP Sql::getTable怎么用?PHP Sql::getTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Db\Sql\Sql
的用法示例。
在下文中一共展示了Sql::getTable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param string $table
* @param Adapter $adapter
* @param ResultSet $selectResultPrototype
* @param Sql\Sql $selectResultPrototype
*/
public function __construct($table, Adapter $adapter, ResultSet $selectResultPrototype = null, Sql\Sql $sql = null)
{
if (!(is_string($table) || $table instanceof Sql\TableIdentifier)) {
throw new \InvalidArgumentException('Table name must be a string or an instance of Zend\\Db\\Sql\\TableIdentifier');
}
$this->table = $table;
$this->adapter = $adapter;
$this->setSelectResultPrototype($selectResultPrototype ?: new ResultSet());
$this->sql = $sql ?: new Sql\Sql($this->adapter, $this->table);
if ($this->sql->getTable() != $this->table) {
throw new Exception\InvalidArgumentException('The table inside the provided Sql object must match the table of this TableGateway');
}
}
示例2: test__construct
/**
* @covers Zend\Db\Sql\Sql::__construct
*/
public function test__construct()
{
$sql = new Sql($this->mockAdapter);
$this->assertFalse($sql->hasTable());
$sql->setTable('foo');
$this->assertSame('foo', $sql->getTable());
$this->setExpectedException('Zend\\Db\\Sql\\Exception\\InvalidArgumentException', 'Table must be a string or instance of TableIdentifier.');
$sql->setTable(null);
}
示例3: sql
/**
* Get a Zend\Db\Sql\Sql object
*
* @param null|string|TableIdentifier $table default: self::DEFAULT_TABLE
* @return \Zend\Db\Sql\Sql
*/
protected function sql($table = self::DEFAULT_TABLE)
{
if (self::DEFAULT_TABLE === $table) {
if (null === $this->sql || $this->sql->getTable() != $this->getTableName()) {
$this->sql = new Sql($this->getDbAdapter(), $this->getTableName());
}
return $this->sql;
}
return new Sql($this->getDbAdapter(), $table);
}