本文整理汇总了PHP中CActiveRecord::behaviors方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::behaviors方法的具体用法?PHP CActiveRecord::behaviors怎么用?PHP CActiveRecord::behaviors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveRecord
的用法示例。
在下文中一共展示了CActiveRecord::behaviors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: behaviors
/**
* Returns the behaviors used for the model
*
* @return array
* @see YdDressing::modelMap
*/
public function behaviors()
{
if (!empty(Yii::app()->dressing->modelMap[get_class($this)]['behaviors'])) {
return Yii::app()->dressing->modelMap[get_class($this)]['behaviors'];
}
return parent::behaviors();
}
示例2: behaviors
public function behaviors()
{
$viewRoute = '/profile';
if (!Yii::app()->params->isMobileApp) {
$viewRoute = '/profile/view';
}
return array_merge(parent::behaviors(), array('X2LinkableBehavior' => array('class' => 'X2LinkableBehavior', 'module' => 'users', 'viewRoute' => $viewRoute), 'ERememberFiltersBehavior' => array('class' => 'application.components.ERememberFiltersBehavior', 'defaults' => array(), 'defaultStickOnClear' => false)));
}
示例3: behaviors
public function behaviors()
{
return CMap::mergeArray(parent::behaviors(), array('deletable' => array('class' => 'common.extensions.behaviors.DeletableBehavior', 'relations' => array('photos' => DeletableBehavior::CASCADE))));
}
示例4: behaviors
/**
* Define behaviors
* @return array
*/
public function behaviors()
{
return array_merge(parent::behaviors(), array('i18n-attribute-messages' => array('class' => 'I18nAttributeMessagesBehavior', 'translationAttributes' => array('title', 'slug', 'book_id'), 'languageSuffixes' => array_keys(Yii::app()->params["languages"]))));
}
示例5: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('LoggableBehavior' => array('class' => 'LoggableBehavior', 'ignored' => array('password'))));
}
示例6: behaviors
public function behaviors()
{
parent::behaviors();
return array('CTimestampBehavior' => array('class' => 'zii.behaviors.CTimestampBehavior'));
}
示例7: behaviors
public function behaviors()
{
$behaviors = array();
if ($this->logUserActivity && Yii::app() instanceof CWebApplication) {
//audit trail behavior
$behaviors['AuditTrailBehavior'] = array('class' => 'application.modules.users.components.behaviors.AuditTrailBehavior');
}
return array_merge(parent::behaviors(), $behaviors);
}
示例8: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('RecordLimitBehavior' => array('class' => 'RecordLimitBehavior', 'limit' => Yii::app()->settings->triggerLogMax, 'timestampField' => 'triggeredAt')));
}
示例9: behaviors
/**
* Returns the behaviors used for the model
*
* @return array
* @see AuditModule::modelMap
*/
public function behaviors()
{
$audit = Yii::app()->getModule('audit');
if (!empty($audit->modelMap[get_class($this)]['behaviors'])) {
return $audit->modelMap[get_class($this)]['behaviors'];
}
return parent::behaviors();
}
示例10: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('X2LinkableBehavior' => array('class' => 'X2LinkableBehavior', 'module' => 'users', 'viewRoute' => '/profile'), 'ERememberFiltersBehavior' => array('class' => 'application.components.ERememberFiltersBehavior', 'defaults' => array(), 'defaultStickOnClear' => false)));
}
示例11: behaviors
/**
* Returns the behaviors used for the model
* @return array
* @see EmailModule::modelMap
*/
public function behaviors()
{
$email = Yii::app()->getModule('email');
if (!empty($email->modelMap[get_class($this)]['behaviors'])) {
return $email->modelMap[get_class($this)]['behaviors'];
}
return parent::behaviors();
}
示例12: multilangLabels
/**
* Translates model labels and adds language after labels of fields generated by Multilingual behaviors.
*
* @param CActiveRecord $model the model to which the labels belong to.
* @param array $labels the untranslated labels
* @param string $messageFile the message file to use to do the translation
*
* @return array the translated labels
*/
public static function multilangLabels($model, $labels, $messageFile = 'admin')
{
$behaviors = $model->behaviors();
$localizedAttributes = array();
foreach ($behaviors as $behavior) {
if ($behavior['class'] == 'application.components.behaviors.MultilingualBehavior') {
foreach ($behavior['localizedAttributes'] as $attribute) {
if (!in_array($attribute, $localizedAttributes)) {
$localizedAttributes[] = $attribute;
}
}
}
if ($behavior['class'] == 'application.components.behaviors.MultilangVirtualAttributesBehavior') {
foreach ($behavior['attributes'] as $attribute) {
if (!in_array($attribute, $localizedAttributes)) {
$localizedAttributes[] = $attribute;
}
}
}
}
foreach ($localizedAttributes as $attribute) {
foreach (Yii::app()->languageManager->languages as $language => $fullLanguage) {
$labels[$attribute . '_' . $language] = $labels[$attribute] . ' (' . Yii::t($messageFile, $fullLanguage) . ')';
}
}
return $labels;
}
示例13: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('CTimestampBehavior' => array('class' => 'zii.behaviors.CTimestampBehavior', 'createAttribute' => 'refreshTime', 'updateAttribute' => 'refreshTime')));
}
示例14: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('CSaveRelationsBehavior' => array('class' => 'CSaveRelationsBehavior'), 'TimestampBehavior' => array('class' => 'TimestampBehavior')));
}
示例15: behaviors
public function behaviors()
{
return array_merge(parent::behaviors(), array('i18n-columns' => array('class' => 'I18nColumnsBehavior', 'translationAttributes' => array('title', 'slug'))));
}