我想INNER JOIN在Zend2中的两个表之间做一个简单的操作.
具体来说,我想在Zend2中这样做:
SELECT * FROM foo, bar WHERE foo.foreign_id = bar.id;
我有一个FooTable:
class FooTable
{
protected $tableGateway;
public function __construct(TableGateway $tableGateway)
{
$this->tableGateway = $tableGateway;
}
public function get($id)
{
$rowset = $this->tableGateway->select(function (Select $select) {
$select->from('foo');
});
}
}
Run Code Online (Sandbox Code Playgroud)
将$select->from('foo');返回一个错误:
==> 由于此对象是在构造函数中使用表和/或模式创建的,因此它是只读的.
所以,我不能调整我的FROM语句来匹配FooTable和之间的简单内连接BarTable.