Skip to content

Instantly share code, notes, and snippets.

@zviryatko
Created April 24, 2014 08:24
Show Gist options
  • Save zviryatko/11246382 to your computer and use it in GitHub Desktop.
Save zviryatko/11246382 to your computer and use it in GitHub Desktop.
Zend framework 2 sql predicate that provide between columns clause.
<?php
/**
* @file
* Provide sql expression where the value between columns
*
* @copyright Copyright (c) 2014 HTML&CMS (http://html-and-cms.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
namespace HTMLandCMS\Db\Sql\Predicate;
use Zend\Db\Sql\Predicate\Between;
/**
* Class BetweenColumns
*
* @method __construct($value = null, $minIdentifier = null, $maxIdentifier = null)
*
* @package HTMLandCMS\Db\Sql\Predicate
*/
class BetweenColumns extends Between {
/**
* Return "where" parts
*
* @return array
*/
public function getExpressionData()
{
return array(
array(
$this->getSpecification(),
array($this->identifier, $this->minValue, $this->maxValue),
array(self::TYPE_VALUE, self::TYPE_IDENTIFIER, self::TYPE_IDENTIFIER),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment