MongoDB\BSON\Binary::__constructConstruit un nouveau binaire
&reftitle.description;
finalpublicMongoDB\BSON\Binary::__constructstringdatainttypeMongoDB\BSON\Binary::TYPE_GENERIC
&reftitle.parameters;
data (string)
Les données binaires.
type (int)
Entier 8 bits non signé indiquant le type de données. Par défaut,
la valeur est MongoDB\BSON\Binary::TYPE_GENERIC si elle n'est pas spécifiée.
&reftitle.errors;
&mongodb.throws.argumentparsing;
Lève une exception MongoDB\Driver\Exception\InvalidArgumentException si type n'est pas un entier non signé de 8 bits.Lève une exception MongoDB\Driver\Exception\InvalidArgumentException si type est MongoDB\BSON\Binary::TYPE_UUID ou MongoDB\BSON\Binary::TYPE_OLD_UUID et data n'a pas exactement 16 octets de longueur.
&reftitle.changelog;
&Version;&Description;PECL mongodb 1.15.0
Le paramètre type est désormais facultatif
et a pour valeur par défaut MongoDB\BSON\Binary::TYPE_GENERIC s'il n'est pas spécifié.
PECL mongodb 1.3.0MongoDB\Driver\Exception\InvalidArgumentException
est levée si type est
MongoDB\BSON\Binary::TYPE_UUID ou
MongoDB\BSON\Binary::TYPE_OLD_UUID et
data n'a pas exactement 16 octets de longueur.
PECL mongodb 1.1.3MongoDB\Driver\Exception\InvalidArgumentException
est levée si type n'est pas un entier non signé
de 8 bits.
&reftitle.examples;
Exemple avec MongoDB\BSON\Binary::__construct
]]>
&example.outputs;
string(3) "foo"
["type"]=>
int(0)
}
]]>
&reftitle.seealso;
Les types BSON