File: bsonserialize.xml

package info (click to toggle)
php-doc 20241205~git.dfcbb86%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 70,956 kB
  • sloc: xml: 968,269; php: 23,883; javascript: 671; sh: 177; makefile: 37
file content (108 lines) | stat: -rw-r--r-- 3,454 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->

<refentry xml:id="mongodb-bson-persistable.bsonserialize" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
 <refnamediv>
  <refname>MongoDB\BSON\Persistable::bsonSerialize</refname>
  <refpurpose>Provides an array or document to serialize as BSON</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <modifier>abstract</modifier> <modifier>public</modifier> <type class="union"><type>array</type><type>stdClass</type><type>MongoDB\BSON\Document</type></type><methodname>MongoDB\BSON\Persistable::bsonSerialize</methodname>
   <void />
  </methodsynopsis>
  <para>
   Called during serialization of the object to BSON. The method must return an
   <type>array</type>, <classname>stdClass</classname>, or
   <classname>MongoDB\BSON\Document</classname>.
  </para>
  <para>
   The return value will always be serialized as a BSON document. The serialized
   document will include a field containing the class name of the object. For
   this reason, it is not possible to return a
   <classname>MongoDB\BSON\PackedArray</classname> instance in this method.
  </para>
  <para>
   Users are encouraged to include an <property>_id</property> property (e.g. a
   <classname>MongoDB\BSON\ObjectId</classname> initialized in the constructor)
   when returning data for a BSON root document. In the absence of an
   <property>_id</property> property, the extension or server will generate a
   <classname>MongoDB\BSON\ObjectId</classname> for insert or upsert
   operations, respectively.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  &no.function.parameters;
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   An <type>array</type>, <classname>stdClass</classname>, or <classname>MongoDB\BSON\Document</classname>
   to be serialized as a BSON document.
  </para>
 </refsect1>

 <refsect1 role="changelog">
  &reftitle.changelog;
  <para>
   <informaltable>
    <tgroup cols="2">
     <thead>
      <row>
       <entry>&Version;</entry>
       <entry>&Description;</entry>
      </row>
     </thead>
     <tbody>
      <row>
       <entry>PECL mongodb 1.17.0</entry>
       <entry>
        <para>
         This method may now also return <classname>MongoDB\BSON\Document</classname>
         instances in addition to <type>array</type> and <classname>stdClass</classname>.
        </para>
       </entry>
      </row>
     </tbody>
    </tgroup>
   </informaltable>
  </para>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <simplelist>
   <member><function>MongoDB\BSON\Serializable::bsonSerialize</function></member>
   <member><function>MongoDB\BSON\Unserializable::bsonUnserialize</function></member>
   <member><interfacename>MongoDB\BSON\Persistable</interfacename></member>
   <member><xref linkend="mongodb.persistence"/></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
-->