Exemplo n.º 1
0
 /**
  * Create Blog Category
  *
  * @param string $sTitle
  * @param string $sUrl
  * @param integer $iSort
  * @param integer $iPid
  *
  * @throws Exception
  *
  * @return ModuleBlog_EntityBlogCategory
  */
 protected function _createCategory($sTitle, $sUrl, $iSort = 0, $iPid = null)
 {
     $oCategory = Engine::GetEntity('ModuleBlog_EntityBlogCategory');
     $oCategory->setTitle($sTitle);
     $oCategory->setUrl($sUrl);
     $oCategory->setSort($iSort);
     $oCategory->setPid($iPid);
     if ($oCategory->_Validate()) {
         $iCategoryId = $this->oEngine->Blog_AddCategory($oCategory);
         $oCategory = $this->oEngine->Blog_GetCategoryById($iCategoryId);
         return $oCategory;
     } else {
         throw new Exception("Create category - validation error");
     }
 }