CakeSchema updated for 2.0

Converting var to public.
Fixes #2276

Signed-off-by: mark_story <mark@mark-story.com>
This commit is contained in:
m 2011-11-20 20:40:23 +01:00 committed by mark_story
parent 02efc24b12
commit 58a2ee064c

View file

@ -351,21 +351,21 @@ class CakeSchema extends Object {
get_object_vars($this), $options get_object_vars($this), $options
)); ));
$out = "class {$name}Schema extends CakeSchema {\n"; $out = "class {$name}Schema extends CakeSchema {\n\n";
if ($path !== $this->path) { if ($path !== $this->path) {
$out .= "\tvar \$path = '{$path}';\n\n"; $out .= "\tpublic \$path = '{$path}';\n\n";
} }
if ($file !== $this->file) { if ($file !== $this->file) {
$out .= "\tvar \$file = '{$file}';\n\n"; $out .= "\tpublic \$file = '{$file}';\n\n";
} }
if ($connection !== 'default') { 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)) { if (empty($tables)) {
$this->read(); $this->read();
@ -379,7 +379,7 @@ class CakeSchema extends Object {
$out .= "}\n"; $out .= "}\n";
$file = new SplFileObject($path . DS . $file, 'w+'); $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)) { if ($file->fwrite($content)) {
return $content; return $content;
} }
@ -395,7 +395,7 @@ class CakeSchema extends Object {
* @return string Variable declaration for a schema class * @return string Variable declaration for a schema class
*/ */
public function generateTable($table, $fields) { public function generateTable($table, $fields) {
$out = "\tvar \${$table} = array(\n"; $out = "\tpublic \${$table} = array(\n";
if (is_array($fields)) { if (is_array($fields)) {
$cols = array(); $cols = array();
foreach ($fields as $field => $value) { foreach ($fields as $field => $value) {