Skip to content

Commit

Permalink
CakeSchema updated for 2.0
Browse files Browse the repository at this point in the history
Converting var to public.
Fixes #2276

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information
m authored and markstory committed Nov 21, 2011
1 parent 02efc24 commit 58a2ee0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/Cake/Model/CakeSchema.php
Expand Up @@ -351,21 +351,21 @@ public function write($object, $options = array()) {
get_object_vars($this), $options
));

$out = "class {$name}Schema extends CakeSchema {\n";
$out = "class {$name}Schema extends CakeSchema {\n\n";

if ($path !== $this->path) {
$out .= "\tvar \$path = '{$path}';\n\n";
$out .= "\tpublic \$path = '{$path}';\n\n";
}

if ($file !== $this->file) {
$out .= "\tvar \$file = '{$file}';\n\n";
$out .= "\tpublic \$file = '{$file}';\n\n";
}

if ($connection !== 'default') {
$out .= "\tvar \$connection = '{$connection}';\n\n";
$out .= "\tpublic \$connection = '{$connection}';\n\n";
}

$out .= "\tfunction before(\$event = array()) {\n\t\treturn true;\n\t}\n\n\tfunction after(\$event = array()) {\n\t}\n\n";
$out .= "\tpublic function before(\$event = array()) {\n\t\treturn true;\n\t}\n\n\tpublic function after(\$event = array()) {\n\t}\n\n";

if (empty($tables)) {
$this->read();
Expand All @@ -379,7 +379,7 @@ public function write($object, $options = array()) {
$out .= "}\n";

$file = new SplFileObject($path . DS . $file, 'w+');
$content = "<?php \n/* {$name} schema generated on: " . date('Y-m-d H:i:s') . " : ". time() . "*/\n{$out}?>";
$content = "<?php \n/* generated on: " . date('Y-m-d H:i:s') . " : ". time() . " */\n{$out}";
if ($file->fwrite($content)) {
return $content;
}
Expand All @@ -395,7 +395,7 @@ public function write($object, $options = array()) {
* @return string Variable declaration for a schema class
*/
public function generateTable($table, $fields) {
$out = "\tvar \${$table} = array(\n";
$out = "\tpublic \${$table} = array(\n";
if (is_array($fields)) {
$cols = array();
foreach ($fields as $field => $value) {
Expand Down

0 comments on commit 58a2ee0

Please sign in to comment.