/** * Returns the Parent from an Entry. * * @return DirectoryEntry Parent entry * @throws Exception if no valid parent is found */ public function getParent() { $entries = DirectoryEntry::findByFile_id($this->parent_id); if (count($entries) === 0) { throw new Exception('No parent found'); } return $entries[0]; }