Gentics Portal.Node PHP API
 All Classes Namespaces Functions Variables Pages
UserPersonalisationAttribute.php
1 <?php
2 
3 /**
4  * Gentics Portal.Node PHP
5  * Author & Copyright (c) by Gentics Software GmbH
6  * sales@gentics.com
7  * http://www.gentics.com
8  * Licenses can be found in the LICENSE.txt file in the root-folder of this installation
9  * You must not use this software without a valid license agreement.
10  *
11  * This is the model class for table "{{user_personalization_attributes}}".
12  * Represents assigning personalisation attribute to user
13  *
14  * The followings are the available columns in table '{{user_personalization_attributes}}':
15  * @property integer $user_id
16  * @property integer $personalisation_attribute_id
17  */
18 class UserPersonalisationAttribute extends CActiveRecord
19 {
20  /**
21  * Returns the static model of the specified AR class.
22  *
23  * @param string $className active record class name.
24  *
25  * @return UserPersonalisationAttribute the static model class
26  */
27  public static function model($className = __CLASS__)
28  {
29  return parent::model($className);
30  }
31 
32  /**
33  * Returns the associated database table name
34  *
35  * @return string
36  */
37  public function tableName()
38  {
39  return '{{user_personalisation_attributes}}';
40  }
41 
42  /**
43  * Returns validation rules for model attributes.
44  *
45  * @return array
46  */
47  public function rules()
48  {
49  // NOTE: you should only define rules for those attributes that
50  // will receive user inputs.
51  return array(
52  array('user_id, personalisation_attribute_id', 'required'),
53  array('user_id, personalisation_attribute_id', 'numerical', 'integerOnly' => true),
54  // The following rule is used by search().
55  // Please remove those attributes that should not be searched.
56  array('user_id, personalisation_attribute_id', 'safe', 'on' => 'search'),
57  );
58  }
59 
60  /**
61  * Returns relational rules.
62  *
63  * @return array
64  */
65  public function relations()
66  {
67  // NOTE: you may need to adjust the relation name and the related
68  // class name for the relations automatically generated below.
69  return array(
70  'user' => array(self::BELONGS_TO, 'User', 'user_id'),
71  'personalisationAttribute' => array(self::BELONGS_TO, 'PersonalisationAttribute', array('personalisation_attribute_id' => 'id'))
72  );
73  }
74 
75  /**
76  * Returns customized attribute labels (name=>label)
77  *
78  * @return array
79  */
80  public function attributeLabels()
81  {
82  return array(
83  'user_id' => 'User',
84  'personalisation_attribute_id' => 'Personalisation Attribute',
85  );
86  }
87 
88  /**
89  * Retrieves a list of models based on the current search/filter conditions.
90  *
91  * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
92  */
93  public function search()
94  {
95  // Warning: Please modify the following code to remove attributes that
96  // should not be searched.
97 
98  $criteria = new CDbCriteria;
99 
100  $criteria->compare('user_id', $this->user_id);
101  $criteria->compare('personalisation_attribute_id', $this->personalisation_attribute_id);
102 
103  return new CActiveDataProvider(
104  $this,
105  array(
106  'criteria' => $criteria,
107  )
108  );
109  }
110 }