简体   繁体   中英

ZF2 multi-join column issue

Using ZF2, I am trying to create multi-join SQL statement, however, I can't get the columns for the second table.

Here's what I have so far,

...extends TableGateway

$select = $this->getSql()->select();
$select->columns(array('*'));
$select->join('acl_privilege', "{$this->table}.rule_privilege_id = acl_privilege.privilege_id");
$predicate = new Where();
$select->where(
    array(
        $predicate->equalTo('rule_resource_id', $resourceId),
        $predicate->equalTo('rule_allow', 1)
    ),
    \Zend\Db\Sql\Predicate\PredicateSet::OP_AND
);

$rows = $this->selectWith($select);

Thanks in advance.

连接表的列在方法join的第三个参数的数组中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM