コード例 #1
0
 /**
  * {@inheritdoc}
  * @SuppressWarnings(PHPMD.UnusedLocalVariable)
  */
 public function loadNext($data, $rightIndex, $upper = null)
 {
     $select = clone $this->select;
     $value = $this->getValueFiled();
     $select->columns(['count' => 'COUNT(*)'])->where("{$value} > ?", $data + self::DELTA);
     if ($upper !== null) {
         $select->where("{$value} < ? ", $data - self::DELTA);
     }
     $offset = $this->select->getConnection()->fetchRow($select)['count'];
     if (!$offset) {
         return false;
     }
     $select = clone $this->select;
     $select->where("{$value} >= ?", $data - self::DELTA);
     if ($upper !== null) {
         $select->where("{$value} < ? ", $data - self::DELTA);
     }
     $select->order("{$value} DESC")->limit($rightIndex - $offset + 1, $offset - 1);
     return $this->arrayValuesToFloat(array_reverse($this->select->getConnection()->fetchCol($select)));
 }