File tree Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Expand file tree Collapse file tree 2 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -953,9 +953,11 @@ public function bindModel($params, $reset = true) {
953
953
* Example: Turn off the associated Model Support request,
954
954
* to temporarily lighten the User model:
955
955
*
956
- * `$this->User->unbindModel( array('hasMany' => array('Supportrequest')) );`
956
+ * `$this->User->unbindModel(array('hasMany' => array('SupportRequest')));`
957
+ * Or alternatively:
958
+ * `$this->User->unbindModel(array('hasMany' => 'SupportRequest'));`
957
959
*
958
- * unbound models that are not made permanent will reset with the next call to Model::find()
960
+ * Unbound models that are not made permanent will reset with the next call to Model::find()
959
961
*
960
962
* @param array $params Set of bindings to unbind (indexed by binding type)
961
963
* @param boolean $reset Set to false to make the unbinding permanent
@@ -967,7 +969,7 @@ public function unbindModel($params, $reset = true) {
967
969
if ($ reset === true && !isset ($ this ->__backAssociation [$ assoc ])) {
968
970
$ this ->__backAssociation [$ assoc ] = $ this ->{$ assoc };
969
971
}
970
-
972
+ $ models = Hash:: normalize (( array ) $ models , false );
971
973
foreach ($ models as $ model ) {
972
974
if ($ reset === false && isset ($ this ->__backAssociation [$ assoc ][$ model ])) {
973
975
unset($ this ->__backAssociation [$ assoc ][$ model ]);
Original file line number Diff line number Diff line change @@ -2181,10 +2181,10 @@ public function testRecursiveUnbind() {
2181
2181
2182
2182
$ this ->assertEquals ($ expected , $ result );
2183
2183
2184
- $ result = $ TestModel ->unbindModel (array ('hasMany ' => array ( 'Child ' ) ));
2184
+ $ result = $ TestModel ->unbindModel (array ('hasMany ' => 'Child ' ));
2185
2185
$ this ->assertTrue ($ result );
2186
2186
2187
- $ result = $ TestModel ->Sample ->unbindModel (array ('belongsTo ' => array ( 'Apple ' ) ));
2187
+ $ result = $ TestModel ->Sample ->unbindModel (array ('belongsTo ' => 'Apple ' ));
2188
2188
$ this ->assertTrue ($ result );
2189
2189
2190
2190
$ result = $ TestModel ->find ('all ' );
You can’t perform that action at this time.
0 commit comments