Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
ZF2 TableGatewayを利用した検索
<?php
$resultSet = $this->tableGateway->select(function ($select) {
$select->where(array(
'id' => 1,
'release_date > ?' => date('Y-m-d', strtotime('-1 year'))
));
$select->where->like('artist', 'The%');
$select->order('artist');
//echo $select->getSqlString($this->tableGateway->getAdapter()->getPlatform());
});
// SELECT `album`.* FROM `album` WHERE `id` = '1' AND release_date > '2013-03-09' AND `artist` LIKE 'The%' ORDER BY `artist` ASC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment