mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-15 16:38:54 +00:00
Fix method references in MongoDB driver docs
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@338288 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
dedcfce805
commit
a693a9fddb
2 changed files with 35 additions and 29 deletions
|
@ -231,9 +231,9 @@
|
|||
<para>
|
||||
If an object is of a class that implements the
|
||||
<classname>MongoDB\BSON\Serializable</classname> interface, call
|
||||
<methodname>bsonSerialize</methodname> and use the returned array or
|
||||
<classname>stdClass</classname> to serialize as a BSON document or
|
||||
array. The BSON type will be determined by the following:
|
||||
<methodname>MongoDB\BSON\Serializable::bsonSerialize</methodname> and use
|
||||
the returned array or <classname>stdClass</classname> to serialize as a
|
||||
BSON document or array. The BSON type will be determined by the following:
|
||||
</para>
|
||||
|
||||
<para>
|
||||
|
@ -249,21 +249,24 @@
|
|||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If <methodname>bsonSerialize</methodname> returns a packed
|
||||
array, serialize as a BSON array.
|
||||
<para>
|
||||
If <methodname>MongoDB\BSON\Serializable::bsonSerialize</methodname>
|
||||
returns a packed array, serialize as a BSON array.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If <methodname>bsonSerialize</methodname> returns a non-packed
|
||||
array or <classname>stdClass</classname>, serialize as a BSON
|
||||
document.
|
||||
<para>
|
||||
If <methodname>MongoDB\BSON\Serializable::bsonSerialize</methodname>
|
||||
returns a non-packed array or <classname>stdClass</classname>,
|
||||
serialize as a BSON document.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>If <methodname>bsonSerialize</methodname> did not return an
|
||||
array or <classname>stdClass</classname>, throw an
|
||||
<classname>MongoDB\Driver\Exception\UnexpectedValueException</classname>
|
||||
exception.
|
||||
<para>
|
||||
If <methodname>MongoDB\BSON\Serializable::bsonSerialize</methodname>
|
||||
did not return an array or <classname>stdClass</classname>, throw an
|
||||
<classname>MongoDB\Driver\Exception\UnexpectedValueException</classname>
|
||||
exception.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
|
@ -282,13 +285,15 @@
|
|||
|
||||
<para>
|
||||
The <property>__pclass</property> property is added to the array or
|
||||
object returned by <methodname>bsonSerialize</methodname>, which means
|
||||
it will overwrite any <property>__pclass</property> key/property in the
|
||||
<methodname>bsonSerialize</methodname> return value. If you want to
|
||||
avoid this behaviour and set your own <property>__pclass</property>
|
||||
value, you must <emphasis>not</emphasis> implement
|
||||
<classname>MongoDB\BSON\Persistable</classname> and should instead
|
||||
implement <classname>MongoDB\BSON\Serializable</classname> directly.
|
||||
object returned by
|
||||
<methodname>MongoDB\BSON\Serializable::bsonSerialize</methodname>, which
|
||||
means it will overwrite any <property>__pclass</property> key/property in
|
||||
the <methodname>MongoDB\BSON\Serializable::bsonSerialize</methodname>
|
||||
return value. If you want to avoid this behaviour and set your own
|
||||
<property>__pclass</property> value, you must <emphasis>not</emphasis>
|
||||
implement <classname>MongoDB\BSON\Persistable</classname> and should
|
||||
instead implement <classname>MongoDB\BSON\Serializable</classname>
|
||||
directly.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
|
@ -461,8 +466,9 @@ UpperClass implements MongoDB\BSON\Persistable {
|
|||
<classname>MongoDB\BSON\Persistable</classname> interface, then the
|
||||
properties of the BSON document, including the
|
||||
<property>__pclass</property> property, are sent as an associative
|
||||
array to the <methodname>bsonUnserialize</methodname> function to
|
||||
initialise the object's properties.
|
||||
array to the
|
||||
<methodname>MongoDB\BSON\Unserializable::bsonUnserialize</methodname>
|
||||
function to initialise the object's properties.
|
||||
</para>
|
||||
<para>
|
||||
If the named class does not exist or does not implement the
|
||||
|
@ -531,8 +537,8 @@ UpperClass implements MongoDB\BSON\Persistable {
|
|||
The properties of the BSON document, <emphasis>including</emphasis>
|
||||
the <property>__pclass</property> property if it exists, will be sent
|
||||
as an associative array to the
|
||||
<methodname>bsonUnserialize</methodname> function to initialise the
|
||||
object's properties.
|
||||
<methodname>MongoDB\BSON\Unserializable::bsonUnserialize</methodname>
|
||||
function to initialise the object's properties.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
@ -603,10 +609,10 @@ UpperClass implements MongoDB\BSON\Persistable {
|
|||
</para>
|
||||
|
||||
<para>
|
||||
The <methodname>bsonUnserialize</methodname> method of YourClass,
|
||||
OurClass, TheirClass iterate over the array and set the properties
|
||||
without modifications. It <emphasis>also</emphasis> sets the
|
||||
<literal>$unserialized</literal> property to <literal>true</literal>:
|
||||
The <methodname>MongoDB\BSON\Unserializable::bsonUnserialize</methodname>
|
||||
method of YourClass, OurClass, TheirClass iterate over the array and set
|
||||
the properties without modifications. It <emphasis>also</emphasis> sets
|
||||
the <literal>$unserialized</literal> property to <literal>true</literal>:
|
||||
|
||||
<programlisting>
|
||||
function bsonUnserialize( array $map )
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<refsect1 role="description">
|
||||
&reftitle.description;
|
||||
<methodsynopsis>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>MongoDB\Driver\WriteResult</type><methodname>MongoDB\Driver\WriteException::getWriteResult</methodname>
|
||||
<modifier>final</modifier> <modifier>public</modifier> <type>MongoDB\Driver\WriteResult</type><methodname>MongoDB\Driver\Exception\WriteException::getWriteResult</methodname>
|
||||
<void />
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
|
@ -40,7 +40,7 @@
|
|||
<refsect1 role="examples">
|
||||
&reftitle.examples;
|
||||
<example>
|
||||
<title><function>MongoDB\Driver\WriteException::getWriteResult</function> example</title>
|
||||
<title><function>MongoDB\Driver\Exception\WriteException::getWriteResult</function> example</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
|
Loading…
Reference in a new issue