/** * Return parent category * * @param void * @return DocumentCategory */ function getCategory() { if ($this->category === false) { $this->category = DocumentCategories::findByDocument($this); } // if return $this->category->getId(); }