正如官方文档所说,我在 ZF2 模型(Zend\Db\TableGateway)中使用了一个匿名 PHP 函数
use Zend\Db\TableGateway\TableGateway;
use Zend\Db\Sql\Select;
$artistTable = new TableGateway('artist', $adapter);
// search for at most 2 artists who's name starts with Brit, ascending
$rowset = $artistTable->select(function (Select $select) {
$select->order('name ASC');
});
如何在此匿名函数中传递参数以在 where 条件中添加过滤器?
我想使用类似的东西:
$this->select(function (Select $select) {
$select->where(array('artist', $artist));
$select->order('name ASC');
});
谢谢!