function attachments() { if (isset($this->_attachments[$this->id])) { return $this->_attachments[$this->id]; } $f2ps = File_to_post::listGet('post_id', array($this->id)); $ids = array(); foreach ($f2ps[$this->id] as $f2p) { $ids[] = $f2p->file_id; } $files = File::multiGet('id', $ids); $this->_attachments[$this->id] = $files->fetchAll(); return $this->_attachments[$this->id]; }