/** * Get all the features in a project, in their hierarchical tree structure * * @param Project $project * @param unknown_type $where * @return ArrayObject */ public function getProjectFeatures(Project $project, $where = array()) { $features = $this->itemLinkService->getOrphanItems('Feature', array('projectid=' => $project->id), 'sortorder asc'); // Get all the milestones that features have. This is preloaded so we can easily bring thevalues // across $milestones = $project->getMilestones(); $mapping = array(); if (count($milestones)) { foreach ($milestones as $milestone) { $mapping[$milestone->id] = $milestone->title; } } foreach ($features as $feature) { // get all the features linked to this feature $this->loadChildFeatures($feature, $mapping); } return $features; }