php-doc-en/reference/mongodb/bson/objectid/construct.xml

104 lines
2.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<refentry xml:id="mongodb-bson-objectid.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<refnamediv>
<refname>MongoDB\BSON\ObjectId::__construct</refname>
<refpurpose>Construct a new ObjectId</refpurpose>
</refnamediv>
<refsect1 role="description">
&reftitle.description;
<methodsynopsis>
<modifier>final</modifier> <modifier>public</modifier> <methodname>MongoDB\BSON\ObjectId::__construct</methodname>
<methodparam choice="opt"><type>string</type><parameter>id</parameter></methodparam>
</methodsynopsis>
</refsect1>
<refsect1 role="parameters">
&reftitle.parameters;
<variablelist>
<varlistentry>
<term><parameter>id</parameter> (<type>string</type>)</term>
<listitem>
<para>
A 24-character hexadecimal string. If not provided, the driver will
generate an ObjectId.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 role="errors">
&reftitle.errors;
<simplelist>
&mongodb.throws.argumentparsing;
<member>Throws <classname>MongoDB\Driver\Exception\InvalidArgumentException</classname> if <parameter>id</parameter> is not a 24-character hexadecimal string.</member>
</simplelist>
</refsect1>
<refsect1 role="examples">
&reftitle.examples;
<example>
<title><function>MongoDB\BSON\ObjectId::__construct</function> example</title>
<programlisting role="php">
<![CDATA[
<?php
var_dump(new MongoDB\BSON\ObjectId());
var_dump(new MongoDB\BSON\ObjectId('000000000000000000000001'));
?>
]]>
</programlisting>
&example.outputs.similar;
<screen>
<![CDATA[
object(MongoDB\BSON\ObjectId)#1 (1) {
["oid"]=>
string(24) "56732d3dda14d81214634921"
}
object(MongoDB\BSON\ObjectId)#1 (1) {
["oid"]=>
string(24) "000000000000000000000001"
}
]]>
</screen>
</example>
</refsect1>
<refsect1 role="seealso">
&reftitle.seealso;
<simplelist>
<member><link xlink:href="&url.mongodb.docs.objectid;">ObjectId Reference</link></member>
<member><link xlink:href="&url.mongodb.docs.bson;#objectid">BSON Types: ObjectId</link></member>
</simplelist>
</refsect1>
</refentry>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->