ensureArray() protected method

Ensures an array or operator expression is converted to an array.
protected ensureArray ( mixed | self $expression ) : mixed
$expression mixed | self
return mixed
示例#1
0
 /**
  * @param mixed|self $expression
  * @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));
 }