Doctrine\MongoDB\Query\Expr::withinBox PHP Method

withinBox() public method

Add $within criteria with a $box shape to the expression.
See also: Expr::geoWithinBox()
See also: http://docs.mongodb.org/manual/reference/operator/box/
Deprecation: 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin
public withinBox ( float $x1, float $y1, float $x2, float $y2 )
$x1 float
$y1 float
$x2 float
$y2 float
    public function withinBox($x1, $y1, $x2, $y2)
    {
        $shape = ['$box' => [[$x1, $y1], [$x2, $y2]]];
        return $this->operator('$within', $shape);
    }

Usage Example

示例#1
0
 /**
  * Add $within criteria with a $box shape to the query.
  *
  * @deprecated 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin
  * @see Builder::geoWithinBox()
  * @see Expr::withinBox()
  * @see http://docs.mongodb.org/manual/reference/operator/box/
  * @param float $x1
  * @param float $y1
  * @param float $x2
  * @param float $y2
  * @return self
  */
 public function withinBox($x1, $y1, $x2, $y2)
 {
     $this->expr->withinBox($x1, $y1, $x2, $y2);
     return $this;
 }