Doctrine\ODM\MongoDB\Aggregation\Expr::ensureArray PHP Method

ensureArray() protected method

protected ensureArray ( mixed | self $expression ) : mixed
$expression mixed | self
return mixed
    protected function ensureArray($expression)
    {
        // Convert field names in expressions
        if (is_string($expression) && substr($expression, 0, 1) === '$') {
            return '$' . $this->getDocumentPersister()->prepareFieldName(substr($expression, 1));
        }
        // Convert PHP types to MongoDB types for everything else
        return Type::convertPHPToDatabaseValue(parent::ensureArray($expression));
    }