Phalcon\Db\Adapter\MongoDB\Operation\DatabaseCommand::__construct PHP Метод

__construct() публичный Метод

Supported options: * readPreference (MongoDB\Driver\ReadPreference): The read preference to use when executing the command. This may be used when issuing the command to a replica set or mongos node to ensure that the driver sets the wire protocol accordingly or adds the read preference to the command document, respectively. * typeMap (array): Type map for BSON deserialization. This will be applied to the returned Cursor (it is not sent to the server).
public __construct ( string $databaseName, array | object $command, array $options = [] )
$databaseName string Database name
$command array | object Command document
$options array Options for command execution
    public function __construct($databaseName, $command, array $options = [])
    {
        if (!is_array($command) && !is_object($command)) {
            throw InvalidArgumentException::invalidType('$command', $command, 'array or object');
        }
        if (isset($options['readPreference']) && !$options['readPreference'] instanceof ReadPreference) {
            throw InvalidArgumentException::invalidType('"readPreference" option', $options['readPreference'], 'MongoDB\\Driver\\ReadPreference');
        }
        if (isset($options['typeMap']) && !is_array($options['typeMap'])) {
            throw InvalidArgumentException::invalidType('"typeMap" option', $options['typeMap'], 'array');
        }
        $this->databaseName = (string) $databaseName;
        $this->command = $command instanceof Command ? $command : new Command($command);
        $this->options = $options;
    }
DatabaseCommand