公式ドキュメントによると、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');
});
ありがとう!