public function init()
 {
     if (!isset($this->modelField)) {
         throw new InvalidConfigException('Must have a modelField set');
     }
     if (!isset($this->modelKey)) {
         throw new InvalidConfigException('Must have a modelKey set');
     }
     parent::init();
 }
 /**
  * Parses the given request and returns the corresponding route and parameters.
  * @param UrlManager $manager the URL manager
  * @param \yii\web\Request $request the request component
  * @return array|boolean the parsing result. The route and the parameters are returned as an array.
  * If false, it means this rule cannot be used to parse this path info.
  */
 public function parseRequest($manager, $request)
 {
     $parts = SlugRuleBase::getParts($request, false);
     if (count($parts) === 0) {
         return false;
     }
     $this->_slugString = array_shift($parts);
     if (strlen($this->_slugString) < $this->minLength) {
         return false;
     }
     $slugClass = $this->slugClass;
     $slug = $slugClass::findBySlug($this->_slugString);
     if (!$slug) {
         return false;
         // this rule does not apply
     }
     $this->_slugModel = $slug;
     return parent::parseRequest($manager, $request);
 }