本文整理汇总了PHP中CActiveRecord::beforeFind方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::beforeFind方法的具体用法?PHP CActiveRecord::beforeFind怎么用?PHP CActiveRecord::beforeFind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveRecord
的用法示例。
在下文中一共展示了CActiveRecord::beforeFind方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beforeFind
public function beforeFind()
{
if (is_subclass_of(Yii::app()->controller, 'BackController') && Yii::app()->languageManager->multilang) {
$this->multilang();
}
return parent::beforeFind();
}
示例2: beforeFind
public function beforeFind()
{
if (parent::beforeFind()) {
$this->username = strtolower($this->username);
return true;
}
return false;
}
示例3: beforeFind
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;
}
示例4: beforeFind
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();
}
示例5: beforeSave
protected function beforeSave()
{
if (parent::beforeFind()) {
if ($this->isNewRecord) {
$this->created_at = time();
$this->score = 100;
}
return true;
}
return false;
}
示例6: beforeFind
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;
}
}
示例7: beforeFind
protected function beforeFind()
{
// Поддержка многих языков после загрузки модели
$this->languageBehavior->multilang();
return parent::beforeFind();
}
示例8: 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();
}
示例9: beforeFind
protected function beforeFind()
{
//$this->categorize($this->illust_category_enum);
return parent::beforeFind();
}
示例10: beforeFind
protected function beforeFind()
{
parent::beforeFind();
$this->incrementCounter(__FUNCTION__);
}
示例11: beforeFind
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();
}
示例12: beforeFind
protected function beforeFind()
{
$this->enableCache();
$this->setDbReading();
parent::beforeFind();
}