34 private $referenceNode;
35 private $oidRoleMap = [];
46 $this->referenceNode = $referenceNode;
48 foreach ($nodeList as $curNode) {
50 if ($curRole !=
null) {
51 $this->oidRoleMap[$curNode->getOID()->__toString()] = $curRole->getOtherRole();
66 if ($valA == $valB) {
return 0; }
67 return ($valA > $valB) ? 1 : -1;
78 $defaultRole = $this->referenceNode->getType();
79 $referenceMapper = $this->referenceNode->getMapper();
82 if ($referenceMapper && $mapper) {
84 $referenceRole = $defaultRole;
87 $oidStr = $node->
getOID()->__toString();
88 if (isset($this->oidRoleMap[$oidStr])) {
89 $nodeRole = $this->oidRoleMap[$oidStr];
90 $relationDesc = $referenceMapper->getRelation($nodeRole);
91 $referenceRole = $relationDesc->getThisRole();
93 $sortkeyDef = $mapper->getSortkey($referenceRole);
94 return $node->
getValue($sortkeyDef[
'sortFieldName']);
getSortkeyValue(Node $node)
Get the sortkey value of a node in the given relation.
getNodeRelation($object)
Get the relation description for a given node.
__construct(Node $referenceNode, array $nodeList)
Constructor.
NodeSortkeyComparator is used to compare nodes by their sortkey in relation to a given node.
Node adds the concept of relations to PersistentObject.
Node related interfaces and classes.
compare(Node $a, Node $b)
Compare function for sorting Nodes in the given relation.