protected function getLinkedObjects($example, $params = NULL, $relation = NULL, $backLinks = FALSE, $wherelike = NULL, $ordering = NULL) { $example = is_object($example) ? get_class($example) : $example; $prototype = new $example(); $id = $this->getPrimary(); if (!$backLinks) { $linkObject = new AmortizeLink($this, $prototype); $data = $linkObject->getLinksFromID($id, $params, $relation, $wherelike, $ordering); } else { $linkObject = new AmortizeLink($prototype, $this); $data = $linkObject->getBackLinksFromID($id, $params, $relation, $wherelike, $ordering); } $data = is_array($data) ? $data : array(); $results = array(); foreach ($data as $fields) { $temp = clone $prototype; $temp->setAttribs($fields, TRUE); $results[] = $temp; } return $results; }