mirror of
https://github.com/php/doc-es.git
synced 2026-03-25 16:02:13 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@336504 c90b9560-bf6c-de11-be94-00142212c4b1
154 lines
3.5 KiB
XML
154 lines
3.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: cb0077d0d554137d7d4eccbc19e31b8615f49352 Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: yes Maintainer: seros -->
|
|
|
|
<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>Crea un nuevo id</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <methodname>MongoId::__construct</methodname>
|
|
<methodparam choice="opt"><type>string|MongoId</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>
|
|
Un string (debe ser de 24 caracteres hexadecimales) o una
|
|
instancia de <classname>MongoId</classname>.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve un nuevo id.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="changelog">
|
|
&reftitle.changelog;
|
|
<informaltable>
|
|
<tgroup cols="2">
|
|
<thead>
|
|
<row>
|
|
<entry>&Version;</entry>
|
|
<entry>&Description;</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>1.4.0</entry>
|
|
<entry>
|
|
Se lanza una excepción al proporcionar un string no válido
|
|
</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title><function>MongoId::__construct</function> example</title>
|
|
<para>
|
|
Este ejemplo muestra cómo crear un nuevo id. Rara vez es neceasrio usar esto, ya que el
|
|
controlador añade automáticamente un id a los arrays antes de almacenarlos en base
|
|
de datos.
|
|
</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>Ejemplo con parámetros</title>
|
|
<para>Este ejemplo muestra cómo usar un parámetro de tipo string para inicializar un MongoId con el valor proporcionado.</para>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$id1 = new MongoId();
|
|
|
|
// crea un nuevo id a partir de $id1
|
|
$id2 = new MongoId("$id1");
|
|
|
|
// muestra que $id1 e $id2 tienen el mismo valor hexadecimal
|
|
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>
|
|
<member><methodname>MongoId::isvalid</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
|
|
-->
|