32 private $_persistenceFacade = null;
39 $this->_persistenceFacade = $persistenceFacade;
46 if (is_object($data)) {
49 $syntaxOk = (is_array($data) && (isset($data[
'oid'])));
51 if ($syntaxOk && isset($data[
'oid']) && preg_match(
'/^\{.+\}$/', $data[
'oid'])) {
61 if (!isset($data[
'oid'])) {
71 $class = get_class($this->_persistenceFacade->create($oid->getType(),
BuildDepth::SINGLE));
74 $remainingData = array();
76 $mapper = $node->getMapper();
77 foreach($data as $key => $value) {
78 if ($mapper->hasAttribute($key)) {
82 $remainingData[$key] = $value;
91 if ($parent != null) {
92 $parent->addNode($node, $role);
95 return array(
'node' => $node,
'data' => $remainingData);
102 if (!($node instanceof
Node)) {
105 $curResult = array();
106 $curResult[
'oid'] = $node->getOID()->__toString();
111 foreach($valueIter as $valueName => $value) {
112 $curResult[$valueName] = $value;
117 $mapper = $node->getMapper();
118 foreach ($mapper->getRelations() as $relation) {
119 $role = $relation->getOtherRole();
120 $relatedNodes = $node->getValue($role);
123 $isMultiValued = $relation->isMultiValued();
124 if ($isMultiValued) {
125 $curResult[$role] = array();
126 foreach ($relatedNodes as $relatedNode) {
129 $curResult[$role][] = array(
'$ref' => $relatedNode->getOID()->__toString());
132 $curResult[$role][] = $this->
serializeNode($relatedNode, array($relation->getThisRole()));
137 $relatedNode = $relatedNodes;
140 $curResult[$role] = array(
'$ref' => $relatedNode->getOID()->__toString());
143 $curResult[$role] = $this->
serializeNode($relatedNode, array($relation->getThisRole()));
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.
__construct(PersistenceFacade $persistenceFacade)
Constructor.
deserializeNode($data, Node $parent=null, $role=null)
serializeNode($node, $rolesToRefOnly=array())
PersistentObjectProxy is proxy for an PersistentObject instance.
static parse($oid)
Parse a serialized object id string into an ObjectId instance.
DojoNodeSerializer is used to serialize Nodes into the Dojo rest format and vice versa.
NodeSerializerBase is a base class for NodeSerialize implementations.
PersistenceFacade defines the interface for PersistenceFacade implementations.
Node adds the concept of relations to PersistentObject.