@@ -267,11 +267,12 @@ function __scaffoldSave($params = array(), $action = 'edit') {
267
267
}
268
268
269
269
if (!$ this ->ScaffoldModel ->exists ()) {
270
+ $ message = sprintf (__ ("Invalid id for %s::edit() " , true ), Inflector::humanize ($ this ->modelKey ));
270
271
if (isset ($ this ->controller ->Session ) && $ this ->controller ->Session ->valid () != false ) {
271
- $ this ->controller ->Session ->setFlash (sprintf ( __ ( " Invalid id for %s::edit() " , true ), Inflector:: humanize ( $ this -> modelKey )) );
272
+ $ this ->controller ->Session ->setFlash ($ message );
272
273
$ this ->controller ->redirect ($ this ->redirect );
273
274
} else {
274
- return $ this ->controller ->flash (sprintf ( __ ( " Invalid id for %s::edit() " , true ), Inflector:: humanize ( $ this -> modelKey )) , $ this ->redirect );
275
+ return $ this ->controller ->flash ($ message , $ this ->redirect );
275
276
}
276
277
}
277
278
}
@@ -283,11 +284,15 @@ function __scaffoldSave($params = array(), $action = 'edit') {
283
284
284
285
if ($ this ->ScaffoldModel ->save ($ this ->controller ->data )) {
285
286
if ($ this ->controller ->_afterScaffoldSave ($ action )) {
287
+ $ message = sprintf (__ ('The %1$s has been %2$s ' , true ),
288
+ Inflector::humanize ($ this ->modelKey ),
289
+ $ success
290
+ );
286
291
if (isset ($ this ->controller ->Session ) && $ this ->controller ->Session ->valid () != false ) {
287
- $ this ->controller ->Session ->setFlash (sprintf ( __ ( ' The %1$s has been %2$s ' , true ), Inflector:: humanize ( $ this -> modelClass ), $ success ) );
292
+ $ this ->controller ->Session ->setFlash ($ message );
288
293
$ this ->controller ->redirect ($ this ->redirect );
289
294
} else {
290
- $ this ->controller ->flash (sprintf ( __ ( ' The %1$s has been %2$s ' , true ), Inflector:: humanize ( $ this -> modelClass ), $ success ) , $ this ->redirect );
295
+ $ this ->controller ->flash ($ message , $ this ->redirect );
291
296
return $ this ->_output ();
292
297
}
293
298
} else {
0 commit comments