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

diacriticSensitive() public method

This method must be called after text().
See also: Builder::diacriticSensitive()
See also: http://docs.mongodb.org/manual/reference/operator/text/
Since: 1.3
public diacriticSensitive ( boolean $diacriticSensitive )
$diacriticSensitive boolean
    public function diacriticSensitive($diacriticSensitive)
    {
        if (!isset($this->query['$text'])) {
            throw new BadMethodCallException('This method requires a $text operator (call text() first)');
        }
        // Remove diacriticSensitive option to keep support for older database versions
        if ($diacriticSensitive) {
            $this->query['$text']['$diacriticSensitive'] = true;
        } elseif (isset($this->query['$text']['$diacriticSensitive'])) {
            unset($this->query['$text']['$diacriticSensitive']);
        }
        return $this;
    }

Usage Example

Example #1
0
 /**
  * A boolean flag to enable or disable diacritic sensitive search for $text
  * criteria.
  *
  * This method must be called after text().
  *
  * @see Builder::diacriticSensitive()
  * @see http://docs.mongodb.org/manual/reference/operator/text/
  * @param bool $diacriticSensitive
  * @return $this
  * @throws BadMethodCallException if the query does not already have $text criteria
  *
  * @since 1.3
  */
 public function diacriticSensitive($diacriticSensitive)
 {
     $this->expr->diacriticSensitive($diacriticSensitive);
     return $this;
 }
All Usage Examples Of Doctrine\MongoDB\Query\Expr::diacriticSensitive