Created
February 25, 2013 05:15
-
-
Save ijmorgado/5027905 to your computer and use it in GitHub Desktop.
This is another really good way to make a custom sql query in ZF2 with table gateway in the model...in this case a LIKE statement... :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$adapter = $this->tableGateway->getAdapter(); | |
$select = new Select(); | |
$select->from('tax_tags') | |
->limit(5) | |
->where->like('tag', "%".$query."%"); | |
$statement = $adapter->createStatement(); | |
$select->prepareStatement($adapter, $statement); | |
$result = $statement->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment