Commit 7cd1d9e 1 parent 27640f9 commit 7cd1d9e Copy full SHA for 7cd1d9e
File tree 1 file changed +3
-5
lines changed
1 file changed +3
-5
lines changed Original file line number Diff line number Diff line change 22
22
* - currently handles all existing relations, will add support for limitation shortly
23
23
* - relations defined with 'through' are not supported yet (http://www.yiiframework.com/doc/guide/1.1/en/database.arr#relational-query-with-through)
24
24
*
25
- * @todo use AR->hasRelated($name)
26
- *
27
25
* @property CActiveRecord $owner The owner AR that this behavior is attached to.
28
26
*
29
27
* @author Carsten Brandt <[email protected] >
@@ -73,7 +71,7 @@ public function beforeValidate($event)
73
71
// attribute of $this->owner has to be changed
74
72
case CActiveRecord::BELONGS_TO :
75
73
76
- if (!$ this ->isRelationSupported ($ relation ))
74
+ if (!$ this ->owner -> hasRelated ( $ name ) || ! $ this -> isRelationSupported ($ relation ))
77
75
break ;
78
76
79
77
$ pk =null ;
@@ -130,7 +128,7 @@ public function afterSave($event)
130
128
*/
131
129
case CActiveRecord::MANY_MANY :
132
130
133
- if (!$ this ->isRelationSupported ($ relation ))
131
+ if (!$ this ->owner -> hasRelated ( $ name ) || ! $ this -> isRelationSupported ($ relation ))
134
132
break ;
135
133
136
134
Yii::trace ('updating MANY_MANY table for relation ' .get_class ($ this ->owner ).'. ' .$ name ,'system.db.ar.CActiveRecord ' );
@@ -174,7 +172,7 @@ public function afterSave($event)
174
172
case CActiveRecord::HAS_MANY :
175
173
case CActiveRecord::HAS_ONE :
176
174
177
- if (!$ this ->isRelationSupported ($ relation ))
175
+ if (!$ this ->owner -> hasRelated ( $ name ) || ! $ this -> isRelationSupported ($ relation ))
178
176
break ;
179
177
180
178
Yii::trace (
You can’t perform that action at this time.
0 commit comments