/** * 获取“父菜单ID”验证规则 * @param mixed $value * @return array */ public function getMenuPidRule($value) { if ($value === 0) { return array(); } return array('NotEqual' => new validator\NotEqualValidator($value, $this->id, Lang::_('SRV_FILTER_MENUS_MENU_PID_NOTEQUAL')), 'DbExists' => new validator\DbExistsValidator($value, true, Lang::_('SRV_FILTER_MENUS_MENU_PID_EXISTS'), $this->getDbProxy(), TableNames::getMenus(), 'menu_id')); }
/** * 通过主键,删除一条记录 * @param integer $menuId * @return integer */ public function removeByPk($menuId) { if (($menuId = (int) $menuId) <= 0) { return false; } $tableName = $this->getTblprefix() . TableNames::getMenus(); $sql = $this->getCommandBuilder()->createDelete($tableName, '`menu_id` = ?'); $rowCount = $this->delete($sql, $menuId); return $rowCount; }