![]() |
CMS
Version 3.9
|
Provides serialization for a number of DataItem classes, grouped under a common tag in the serialized XML. More...
Public Member Functions | |
__construct ($groupTag) | |
Creates the CompoundSerializationHandler. More... | |
addTarget ($class, $constraint="") | |
Add a target DataItem with optional constraint. More... | |
export () | |
Exports the target DataItems to XML. More... | |
import ($doc, $tx) | |
Import from a serialized XML document. More... | |
retrieve ($doc, $class) | |
Retrieves serialized objects from the provided XML document, but does not store them in the database. More... | |
Public Attributes | |
$groupTag | |
$classes = array() | |
$constraints = array() | |
Provides serialization for a number of DataItem classes, grouped under a common tag in the serialized XML.
Use this when your component needs to serialize a number of related objects under the same transaction.
To serialize two or more items, you would create the handler like this: new ComponentSerializationHandler("GroupTag", Class1, Class2)
You can provide database constraints for export for each class by passing an array containing the class name and the constraint:
new CompoundSerializationHandler("GroupTag", array(Class1, "WHERE active=1"), Class2)
Definition at line 456 of file serialization_manager.inc.
CompoundSerializationHandler::__construct | ( | $groupTag | ) |
Creates the CompoundSerializationHandler.
string | $groupTag | the tag name to be used to group the XML output |
FakoliException |
Definition at line 467 of file serialization_manager.inc.
CompoundSerializationHandler::addTarget | ( | $class, | |
$constraint = "" |
|||
) |
Add a target DataItem with optional constraint.
string | $class | the target DataItem class |
string | $constraint | optional database constraint to use for export |
Definition at line 494 of file serialization_manager.inc.
CompoundSerializationHandler::export | ( | ) |
Exports the target DataItems to XML.
Definition at line 503 of file serialization_manager.inc.
CompoundSerializationHandler::import | ( | $doc, | |
$tx | |||
) |
Import from a serialized XML document.
DOMDocument | $doc | The document to be used as the source of the import |
DataTransaction | $tx | The database transaction to join when creating imported objects |
Definition at line 520 of file serialization_manager.inc.
CompoundSerializationHandler::retrieve | ( | $doc, | |
$class | |||
) |
Retrieves serialized objects from the provided XML document, but does not store them in the database.
Instead they are returned as an array so that further processing can be carried out.
DOMDocument | $doc | The document to be used as the source of the retrieval |
string | $class | The class of objects to retrieve |
Definition at line 542 of file serialization_manager.inc.
CompoundSerializationHandler::$classes = array() |
Definition at line 459 of file serialization_manager.inc.
CompoundSerializationHandler::$constraints = array() |
Definition at line 460 of file serialization_manager.inc.
CompoundSerializationHandler::$groupTag |
Definition at line 458 of file serialization_manager.inc.