php-doc-en/reference/mongodb/bson/persistable.xml

92 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongodb-bson-persistable" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MongoDB\BSON\Persistable interface</title>
<titleabbrev>MongoDB\BSON\Persistable</titleabbrev>
<partintro>
<!-- {{{ MongoDB\BSON\Persistable intro -->
<section xml:id="mongodb-bson-persistable.intro">
&reftitle.intro;
<para>
Classes may implement this interface to take advantage of automatic ODM
(object document mapping) behavior in the driver. During serialization, the
driver will inject a <property>__pclass</property> property containing the
PHP class name into the data returned by
<function>MongoDB\BSON\Serializable::bsonSerialize</function>. During
unserialization, the same <property>__pclass</property> property will then
be used to infer the PHP class (independent of any
<link linkend="mongodb.persistence.typemaps">type map</link> configuration)
to be constructed before
<function>MongoDB\BSON\Unserializable::bsonUnserialize</function> is
invoked. See <xref linkend="mongodb.persistence"/> for additional
information.
</para>
<note>
<para>
Even if <function>MongoDB\BSON\Serializable::bsonSerialize</function> would
return a sequential array, injection of the <property>__pclass</property>
property will cause the object to be serialized as a BSON document.
</para>
</note>
</section>
<!-- }}} -->
<section xml:id="mongodb-bson-persistable.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoDB\BSON\Persistable</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoDB\BSON\Persistable</classname>
</ooclass>
<oointerface>
<interfacename>MongoDB\BSON\Unserializable</interfacename>
</oointerface>
<oointerface>
<interfacename>MongoDB\BSON\Serializable</interfacename>
</oointerface>
</classsynopsisinfo>
<!-- }}} -->
<classsynopsisinfo role="comment">&InheritedMethods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongodb-bson-serializable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongodb-bson-unserializable')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[not(@role='procedural')])" />
</classsynopsis>
<!-- }}} -->
</section>
</partintro>
</phpdoc:classref>
<!-- 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
-->