public function getOrderObjects(NodeQuery $nodeQuery, $ignoreNone = false)
 {
     $nodeRefs = $nodeQuery->getParameter('NodeRefs.normalized');
     $firstElement = current($nodeRefs)->getElement();
     $offset = $nodeQuery->getOffset() != null ? $nodeQuery->getOffset() : 0;
     $limit = $nodeQuery->getLimit();
     // ORDER BYS
     $arr = array('Title', 'ActiveDate', 'CreationDate', 'SortOrder', 'TreeID');
     $default = $firstElement->getDefaultOrder();
     if (empty($default)) {
         $default = 'ActiveDate DESC';
     }
     if (count($order = explode(' ', $default)) == 2) {
         $field = $order[0];
         $direction = $order[1];
         $defaultSorts = array($field => $direction);
     }
     $dtoSorts = $nodeQuery->getOrderBys();
     if ($dtoSorts == null && !$ignoreNone) {
         $dtoSorts = $defaultSorts;
     }
     $diff = array_diff(array_keys($dtoSorts), array_keys($arr));
     $merged = array_merge($diff, $arr);
     $sorts = array_unique($merged);
     $orderObjects = array();
     $metaCount = 1;
     foreach ($sorts as $name => $column) {
         if (is_int($name)) {
             $name = $column;
         }
         if (isset($dtoSorts[$name])) {
             $direction = $dtoSorts[$name];
             if (strcasecmp($name, 'NodeRefs') === 0) {
                 //$dtoParameterToSortBy = $direction;
                 $nodeRefs = array_slice($nodeRefs, 0, $limit + $offset);
                 $orderObjects[] = new NodeOrderBy('NodeRef', $nodeRefs);
             } else {
                 if (strpos($name, '#') !== false) {
                     //$orderByMeta = new MetaPartial($name);
                     $name = substr($name, strpos($name, '#') + 1);
                     if ($firstElement->getSchema()->hasMetaDef($name)) {
                         $s = $firstElement->getSchema()->getMetaDef($name);
                         $datatype = $s->Datatype;
                         $column = "{$datatype}Value{$metaCount}";
                         $metaCount++;
                         $orderObjects[] = new NodeOrderBy($column, $direction, $name, $datatype);
                     }
                 } else {
                     $orderObjects[] = new NodeOrderBy($column, $direction);
                 }
             }
         }
     }
     return $orderObjects;
 }