我实施了自定义搜索,现在我需要为date
列选择范围内的值。
public function search($params)
{
$query = Books::find();
//.....
$timestampStart = strtotime($this->dateStart),
$timestampEnd = strtotime($this->dateEnd)
// How to add BETWEEN here?!!?!
$query->andBetween('date', $timestampStart, $timestampEnd) // pseudo-code
从文档中,如何使用它并不完全清楚: https://github.com/yiisoft/yii2/blob/master/docs/guide/db-query-builder.md