Skip to content

Commit

Permalink
Fix error creating schema files.
Browse files Browse the repository at this point in the history
If you removed app/Config/Schema and tried to create
schema files, you'd get an error instead of a file.

Fixes #2618
  • Loading branch information
markstory committed Feb 26, 2012
1 parent 2a9a103 commit faeb7b4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Model/CakeSchema.php
Expand Up @@ -384,9 +384,9 @@ public function write($object, $options = array()) {
}
$out .= "}\n";

$file = new SplFileObject($path . DS . $file, 'w+');
$file = new File($path . DS . $file, true);
$content = "<?php \n/* generated on: " . date('Y-m-d H:i:s') . " : ". time() . " */\n{$out}";
if ($file->fwrite($content)) {
if ($file->write($content)) {
return $content;
}
return false;
Expand Down

0 comments on commit faeb7b4

Please sign in to comment.