/** * Converts all UOIDs in $this->array to objects. * @return bool */ protected function _uoids2Objs() { // is this array associated with an object if (!$this->o) { return false; } // get manager if (!($m = $this->o->epGetManager())) { return false; } // save all the encode oids $uoids = array(); foreach ($this->array as $k => $v) { if (is_string($v)) { $uoids[$k] = $v; } } // call manager to get object by encoded id if (!($os = $m->getByUoids(array_values($uoids)))) { return false; } // match up the objects with the right index in the array // not going to work as duplicates can exist and array_flip // will destroy the duplicates // $uoid_keys = array_flip($uoids); foreach ($os as &$o) { $uoid = $m->encodeUoid($o); while (($index = array_search($uoid, $uoids)) !== FALSE) { //$this->array[$uoid_keys[$uoid]] = $o; $this->array[$index] = $o; // take it out so that any duplicates will be found unset($uoids[$index]); } } return true; }
/** * Convert the encoded oid * @param string $eoid (encoded object id) * @return epObject */ protected function &_oid2Object($eoid) { // is this array associated with an object if (!$this->o) { return $eoid; } // get manager if (!($m = $this->o->epGetManager())) { return $eoid; } // call manager to get object by encoded id if ($o = $m->getByEncodeOid($eoid)) { return $o; } // return encode oid if can't get object return $eoid; }