mirror of
https://github.com/php/doc-es.git
synced 2026-04-24 07:38:19 +02:00
2bcb75ef22
git-svn-id: https://svn.php.net/repository/phpdoc/es/trunk@336595 c90b9560-bf6c-de11-be94-00142212c4b1
104 lines
2.8 KiB
XML
104 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 88fb3e60e4165df620d3c8ead7111db54d38f8cd Maintainer: seros Status: ready -->
|
|
<!-- Reviewed: no -->
|
|
<!-- $Revision$ -->
|
|
<refentry xml:id="mongocollection.createdbref" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
<refnamediv>
|
|
<refname>MongoCollection::createDBRef</refname>
|
|
<refpurpose>Crea una referencia a una base de datos</refpurpose>
|
|
</refnamediv>
|
|
|
|
<refsect1 role="description">
|
|
&reftitle.description;
|
|
<methodsynopsis>
|
|
<modifier>public</modifier> <type>array</type><methodname>MongoCollection::createDBRef</methodname>
|
|
<methodparam><type>mixed</type><parameter>document_or_id</parameter></methodparam>
|
|
</methodsynopsis>
|
|
</refsect1>
|
|
|
|
<refsect1 role="parameters">
|
|
&reftitle.parameters;
|
|
<para>
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>
|
|
<parameter>document_or_id</parameter>
|
|
</term>
|
|
<listitem>
|
|
<para>
|
|
Si se proporciona un array o un objeto, su campo <literal>_id</literal> será
|
|
usado como ID de referencia. Si se proporciona un <classname>MongoId</classname> o
|
|
un escalar, se usará como ID de referencia.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="returnvalues">
|
|
&reftitle.returnvalues;
|
|
<para>
|
|
Devuelve un array de referencia a base de datos.
|
|
</para>
|
|
<para>
|
|
Si se proporcionó un array sin el campo <literal>_id</literal> como
|
|
parámetro <literal>document_or_id</literal>, será devuelto &null;.
|
|
</para>
|
|
</refsect1>
|
|
|
|
<refsect1 role="examples">
|
|
&reftitle.examples;
|
|
<example>
|
|
<title>Ejemplo de <methodname>MongoCollection::createDBRef</methodname></title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
|
|
$canciones = $db->canciones;
|
|
$listasDeReproduccion = $db->listasdereproduccion;
|
|
|
|
// crea una referencia a una canción
|
|
$manamana = $canciones->findOne(array('titulo' => 'Ma na ma na'));
|
|
$refACancion = $canciones->createDBRef($manamana);
|
|
|
|
// añade la referencia a mi lista de reproducción
|
|
$listasDeReproduccion->update(array('usuario' => 'yo'), array('$push' => array('listadecanciones' => $refACancion)));
|
|
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</refsect1>
|
|
|
|
<refsect1 role="seealso">
|
|
&reftitle.seealso;
|
|
<para>
|
|
<simplelist>
|
|
<member><methodname>MongoCollection::getDBRef</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
|
|
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
|
|
-->
|