Doctrine\MongoDB\Query\Query::__construct PHP Method

__construct() public method

Constructor.
public __construct ( Doctrine\MongoDB\Collection $collection, array $query, array $options )
$collection Doctrine\MongoDB\Collection
$query array
$options array
    public function __construct(Collection $collection, array $query, array $options)
    {
        switch ($query['type']) {
            case self::TYPE_FIND:
            case self::TYPE_FIND_AND_UPDATE:
            case self::TYPE_FIND_AND_REMOVE:
            case self::TYPE_INSERT:
            case self::TYPE_UPDATE:
            case self::TYPE_REMOVE:
            case self::TYPE_GROUP:
            case self::TYPE_MAP_REDUCE:
            case self::TYPE_DISTINCT:
            case self::TYPE_GEO_NEAR:
            case self::TYPE_COUNT:
                break;
            default:
                throw new InvalidArgumentException('Invalid query type: ' . $query['type']);
        }
        $this->collection = $collection;
        $this->query = $query;
        $this->options = $options;
    }

Usage Example

Example #1
0
 public function __construct(DocumentManager $dm, ClassMetadata $class, Database $database, Collection $collection, array $query, array $options, $cmd, $hydrate, $refresh)
 {
     parent::__construct($database, $collection, $query, $options, $cmd);
     $this->dm = $dm;
     $this->class = $class;
     $this->hydrate = $hydrate;
     $this->refresh = $refresh;
 }
All Usage Examples Of Doctrine\MongoDB\Query\Query::__construct