32 return 'account_users';
43 array(
'UserId, AccountTypeId',
'required'),
44 array(
'UserId, AccountTypeId',
'length',
'max' => 20),
47 array(
'UserId, AccountTypeId',
'safe',
'on' =>
'search'),
59 'AccountTypes' => array(self::BELONGS_TO,
'AccountTypes',
'AccountTypeId'),
60 'User' => array(self::BELONGS_TO,
'User',
'UserId'),
71 'AccountTypeId' =>
'Account Type',
91 $criteria =
new CDbCriteria();
93 $criteria->compare(
'UserId', $this->UserId,
true);
94 $criteria->compare(
'AccountTypeId', $this->AccountTypeId,
true);
96 return new CActiveDataProvider($this, array(
97 'criteria' => $criteria,
109 public static function model($className = __CLASS__)
121 if (empty($userId)) {
138 if (empty($userId) || empty($accountType)) {
142 'Type' => $accountType,
144 if (empty($AccountTypes)) {
149 if (empty($AccountUsers)) {
153 $AccountUsers->UserId = $userId;
154 $AccountUsers->AccountTypeId = $AccountTypes->Id;
156 return $AccountUsers->save();
166 'AccountTypeId' => $accountTypeId,
168 foreach ($AccountUsers as $AccountUser) {