/** * * @param int $id * * @return Tracker_Artifact | null */ public function getArtifactByFileInfoId($id) { $row = $this->dao->searchArtifactIdByFileInfoId($id)->getRow(); if (!$row) { return; } return $this->artifact_factory->getArtifactById($row['artifact_id']); }
/** * get an instance of fileinfo, identified by its $id * * @param Tracker_FormElement_Field_File $field The field the fileinfo belongs to * @param int $id The id of the fileinfo * @param array $row The raw data of the fileinfo (optionnal) * * @return Tracker_FileInfo or null if not found */ public static function instance(Tracker_FormElement_Field_File $field, $id, $row = null) { if (!isset(self::$instances_by_id[$id])) { self::$instances_by_id[$id] = null; $dao = new Tracker_FileInfoDao(); //TODO: check that the attachment belongs to the field if ($row || ($row = $dao->searchById($id)->getRow())) { self::$instances_by_id[$id] = new Tracker_FileInfo($row['id'], $field, $row['submitted_by'], $row['description'], $row['filename'], $row['filesize'], $row['filetype']); } } return self::$instances_by_id[$id]; }