mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 19:08:54 +00:00

for file in `find -name '*.xml'`; do sed -i -e 's/<initializer>null<\/initializer>/<initializer>\&null;<\/initializer>/i' $file; done git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@298918 c90b9560-bf6c-de11-be94-00142212c4b1
129 lines
2.9 KiB
XML
129 lines
2.9 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
|
|
<refentry xml:id="mongoid.construct" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MongoId::__construct</refname>
|
|
<refpurpose>Creates a new id</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<methodname>MongoId::__construct</methodname>
|
|
<methodparam choice="opt"><type>string</type><parameter>id</parameter><initializer>&null;</initializer></methodparam>
|
|
</methodsynopsis>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>id</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
A string to use as the id. Must be 24 hexidecimal characters. If an
|
|
invalid string is passed to this constructor, the constructor will ignore
|
|
it and create a new id value.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Returns a new id.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>MongoId::__construct</function> example</title>
|
|
<para>
|
|
This example shows how to create a new id. This is seldom necessary, as the
|
|
driver adds an id to arrays automatically before storing them in the
|
|
database.
|
|
</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$id1 = new MongoId();
|
|
echo "$id1\n";
|
|
|
|
$id2 = new MongoId();
|
|
echo "$id2\n";
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
49a7011a05c677b9a916612a
|
|
49a702d5450046d3d515d10d
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
<example>
|
|
<title>Parameter example</title>
|
|
<para>This example shows how to use a string parameter to initialize a MongoId with a given value.</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$id1 = new MongoId();
|
|
|
|
// create a new id from $id1
|
|
$id2 = new MongoId("$id1");
|
|
|
|
// show that $id1 and $id2 have the same hexidecimal value
|
|
var_dump($id1 == $id2);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
&example.outputs.similar;
|
|
<screen>
|
|
<![CDATA[
|
|
bool(true)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>MongoId::__toString</methodname></member>
|
|
</simplelist>
|
|
</para>
|
|
</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
|
|
-->
|