public function beforeSave() { $this->name = trim(mb_strtolower($this->name)); $this->firstLetter = mb_substr($this->name, 0, 1); $this->lastLetter = LetterUtils::getLastLetter($this->name); return parent::beforeSave(); }
public static function checkUserStep($userStep) { $textError = self::ERROR_SUCCESS; if (!LetterUtils::checkLastAndFirstLetter($userStep)) { $textError = self::ERROR_CITY_LETTER . " '" . Gamestep::model()->getLastLetter() . "'"; } if (Gamestep::model()->checkCityAlreadyExist($userStep)) { $textError = self::ERROR_CITY_USED; } return $textError; }