controllers/DictionaryController.php
public function actionAddHeadword($class, $word)
    {
        $extMgr = Yii::$app->rhoone->ext;
        /* @var $extMgr \rhoone\base\ExtensionManager */
        $model = $extMgr->getModel($class);
        if (!$model) {
            throw new Exception('`' . $class . '` does not exist.');
        }
        try {
            $result = $model->setHeadword($word, true);
            echo ($result ? "$word added." : "Failed to add.");
        } catch (\Exception $ex) {
            throw new Exception($ex->getMessage());
        }
        return 0;
    }
public function actionAddHeadword($class, $word)
    {
        $extMgr = Yii::$app->rhoone->ext;
        /* @var $extMgr \rhoone\base\ExtensionManager */
        $model = $extMgr->getModel($class);
        if (!$model) {
            throw new Exception('`' . $class . '` does not exist.');
        }
        try {
            $result = $model->setHeadword($word, true);
            echo ($result ? "$word added." : "Failed to add.");
        } catch (\Exception $ex) {
            throw new Exception($ex->getMessage());
        }
        return 0;
    }
public function actionAddHeadword ( $ class , $ word ) { $ extMgr = Yii :: $ app -> rhoone -> ext ; /* @var $extMgr \rhoone\base\ExtensionManager */ $ model = $ extMgr -> getModel ( $ class ) ; if ( ! $ model ) { throw new Exception ( '`' . $ class . '` does not exist.' ) ; } try { $ result = $ model -> setHeadword ( $ word , true ) ; echo ( $ result ? "$word added." : "Failed to add." ) ; } catch ( \ Exception $ ex ) { throw new Exception ( $ ex -> getMessage ( ) ) ; } return 0 ; }
Add headword to class.
@param string $class
@param string $word
@throws Exception
Add headword to class .