/** * Método que retorna uma categoria diretamente do banco. * * @param int $categoriaId O id da categoria */ public function getCategoriaBanco($categoriaId) { if (!is_int($categoriaId)) { throw new Exception('A categoria informada não é válida'); } if (!$categoriaId) { throw new Exception('A categoria informada é inválida'); } $categorias = new ModelBase($this->getTabela() . '_categorias'); $categorias->setId($categoriaId); $this->categoria = $categoriaId; return $categorias->getObject(); }