30 private $_serializedOIDs = array();
31 private $_persistenceFacade = null;
38 $this->_persistenceFacade = $persistenceFacade;
45 if (is_object($data)) {
48 $syntaxOk = (is_array($data) && (isset($data[
'oid'])));
50 if ($syntaxOk && isset($data[
'oid']) && preg_match(
'/^\{.+\}$/', $data[
'oid'])) {
60 if (!isset($data[
'oid'])) {
70 $class = get_class($this->_persistenceFacade->create($oid->getType(),
BuildDepth::SINGLE));
73 $remainingData = array();
75 $foundNodeAttribute =
false;
76 $mapper = $node->getMapper();
77 foreach($data as $key => $value) {
78 if ($mapper->hasAttribute($key) || $mapper->hasRelation($key)) {
80 $foundNodeAttribute =
true;
83 $remainingData[$key] = $value;
87 if ($foundNodeAttribute) {
89 unset($remainingData[
'oid']);
97 if ($parent != null) {
98 $parent->addNode($node, $role);
101 return array(
'node' => $node,
'data' => $remainingData);
108 if (!($node instanceof
Node)) {
111 $curResult = array();
112 $oidStr = $node->getOID()->__toString();
113 $curResult[
'oid'] = $oidStr;
115 if (!in_array($oidStr, $this->_serializedOIDs)) {
116 $this->_serializedOIDs[] = $oidStr;
121 foreach($valueIter as $valueName => $value) {
122 $curResult[$valueName] = $value;
127 $mapper = $node->getMapper();
128 foreach ($mapper->getRelations() as $relation) {
129 $role = $relation->getOtherRole();
130 $relatedNodes = $node->getValue($role);
133 $curResult[$role] = array();
134 $isMultiValued = $relation->isMultiValued();
135 if ($isMultiValued) {
136 foreach ($relatedNodes as $relatedNode) {
143 $relatedNode = $relatedNodes;
IllegalArgumentException signals an exception in method arguments.
NodeValueIterator is used to iterate over all persistent values of a Node (not including relations)...
deserializeValue(Node $node, $key, $value)
Deserialize a node value.
deserializeNode($data, Node $parent=null, $role=null)
SoapNodeSerializer is used to serialize Nodes into the soap format and vice versa.
static parse($oid)
Parse a serialized object id string into an ObjectId instance.
NodeSerializerBase is a base class for NodeSerialize implementations.
PersistenceFacade defines the interface for PersistenceFacade implementations.
__construct(PersistenceFacade $persistenceFacade)
Constructor.
Node adds the concept of relations to PersistentObject.