Skip to content

Instantly share code, notes, and snippets.

@newage
Last active August 29, 2015 14:03
Show Gist options
  • Save newage/4937b014b4fbc8a4cbf4 to your computer and use it in GitHub Desktop.
Save newage/4937b014b4fbc8a4cbf4 to your computer and use it in GitHub Desktop.
Add predicate to where with identifier and credential expressions in ZF2
$adapter = $this->getAdapter();
$platform = $adapter->getPlatform();
$predicateIn = 'DATE('.$platform->quoteIdentifierChain(array('dt_created')).')';
$predicateIn .= " IN (";
$predicateIn .= $platform->quoteValueList($days);
$predicateIn .= ")";
$select->where(array($predicateIn));
@newage
Copy link
Author

newage commented Oct 1, 2014

For example WHERE DATE(date_field) IN ('2003-12-31', '2013-10-20')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment