/** * Return array or property => value pairs that describes this object * * @param IUser $user * @param boolean $detailed * @return array */ function describeForApi(IUser $user, $detailed = false) { $mil_t = new Milestone($this->getId()); $result = $mil_t->describeForApi($user, $detailed, $for_interface); // In this exact order, it's important! $result = array_merge(parent::describeForApi($user, $detailed, $for_interface), $result); $result['id'] = $this->getId(); if ($detailed) { $result['custom_percent_complete'] = $this->getPercentsDone(false); $result['remaining_time'] = $this->getRemainingTime(); $result['summed_time'] = $this->tracking()->sumTime(Authentication::getLoggedUser()); } return $result; }