public function beforeFind() { if (is_subclass_of(Yii::app()->controller, 'BackController') && Yii::app()->languageManager->multilang) { $this->multilang(); } return parent::beforeFind(); }
public function beforeFind() { if (parent::beforeFind()) { $this->username = strtolower($this->username); return true; } return false; }
protected function beforeFind() { parent::beforeFind(); if (isset(Yii::app()->user->latitude, Yii::app()->user->longitude)) { $this->attachBehaviors(array('NearScopeBehavior' => array('class' => 'ext.behavior.NearScopeBehavior', 'latitude' => Yii::app()->user->latitude, 'longitude' => Yii::app()->user->longitude, 'enableDistance' => true))); $this->near(); //CTimeBehavior实现了自动调用。人家用的是事件。我们没有用事件,只能是手工调用了 } return true; }
public function beforeFind() { $attrs = $this->attributeLabels(); if ($this->tableName() != "sites") { if (@$attrs['site_id']) { $this->getDbCriteria()->mergeWith(array('alias' => 't', 'condition' => "t.site_id=" . (int) Sites::model()->getCurrentSite()->id)); } } //var_dump($this->dbCriteria); parent::beforeFind(); }
protected function beforeSave() { if (parent::beforeFind()) { if ($this->isNewRecord) { $this->created_at = time(); $this->score = 100; } return true; } return false; }
protected function beforeFind() { if (parent::beforeFind()) { if ($this->hora_inicio) { $this->hora_inicio = Horario::hora($this->hora_inicio, true); } if ($this->hora_fin) { $this->hora_fin = Horario::hora($this->hora_fin, true); } return true; } else { return false; } }
protected function beforeFind() { // Поддержка многих языков после загрузки модели $this->languageBehavior->multilang(); return parent::beforeFind(); }
protected function beforeFind() { $t = $this->tableAlias; // Select community ID $select = array('(CASE WHEN ' . $t . '.identity LIKE "STEAM_%" THEN 76561197960265728 + CAST(SUBSTRING(' . $t . '.identity, 9, 1) AS UNSIGNED) + CAST(SUBSTRING(' . $t . '.identity, 11) * 2 AS UNSIGNED) WHEN ' . $t . '.identity LIKE "[U:%]" THEN 76561197960265728 + CAST(SUBSTRING(' . $t . '.identity, 6, CHAR_LENGTH(' . $t . '.identity) - 6) AS UNSIGNED) END) AS admin_community_id'); if ($this->dbCriteria->select === '*') { array_unshift($select, '*'); } $this->dbCriteria->mergeWith(array('select' => $select)); parent::beforeFind(); }
protected function beforeFind() { //$this->categorize($this->illust_category_enum); return parent::beforeFind(); }
protected function beforeFind() { parent::beforeFind(); $this->incrementCounter(__FUNCTION__); }
protected function beforeFind() { // Xử lý ngôn ngữ if ($this->enableLanguage) { $tableSchema = $this->getTableSchema(); if (isset($tableSchema->columns['locale'])) { $criteria = new CDbCriteria(); $criteria->condition = "locale = '" . Yii::app()->language . "'"; $this->dbCriteria->mergeWith($criteria); //$this->setAttribute('locale', Yii::app()->language); } } parent::beforeFind(); }
protected function beforeFind() { $this->enableCache(); $this->setDbReading(); parent::beforeFind(); }