diff --git a/scripts/Builder/Components/Controller.php b/scripts/Builder/Components/Controller.php index 3f49c077d..8d7a516a7 100755 --- a/scripts/Builder/Components/Controller.php +++ b/scripts/Builder/Components/Controller.php @@ -75,6 +75,7 @@ public function build(){ $className = Utils::camelize($name); $controllerPath = $path."public/".$controllersDir.$className."Controller.php"; $code = "_options['force']==true){ file_put_contents($controllerPath, $code); } else { diff --git a/scripts/Builder/Components/Model.php b/scripts/Builder/Components/Model.php index 29ff3109b..3b0c408f5 100755 --- a/scripts/Builder/Components/Model.php +++ b/scripts/Builder/Components/Model.php @@ -244,14 +244,14 @@ public function build(){ if($useSettersGetters){ $attributes[] = "\t/**\n\t * @var $type\n\t */\n\tprotected \${$field['Field']};\n"; $setterName = Utils::camelize($field['Field']); - $setters[] = "\t/**\n\t * Method to set the value of field {$field['Field']}\n\t * @param $type \${$field['Field']}\n\t */\n\tpublic function set$setterName(\${$field['Field']}){\n\t\t\$this->{$field['Field']} = \${$field['Field']};\n\t}\n"; + $setters[] = "\t/**\n\t * Method to set the value of field {$field['Field']}\n\n\t * @param $type \${$field['Field']}\n\t */\n\tpublic function set$setterName(\${$field['Field']}){\n\t\t\$this->{$field['Field']} = \${$field['Field']};\n\t}\n"; if(isset($this->_typeMap[$type])){ - $getters[] = "\t/**\n\t * Returns the value of field {$field['Field']}\n\t * @return $type\n\t */\n\tpublic function get$setterName(){\n\t\tif(\$this->{$field['Field']}){\n\t\t\treturn new {$this->_typeMap[$type]}(\$this->{$field['Field']});\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n"; + $getters[] = "\t/**\n\t * Returns the value of field {$field['Field']}\n\n\t * @return $type\n\t */\n\tpublic function get$setterName(){\n\t\tif(\$this->{$field['Field']}){\n\t\t\treturn new {$this->_typeMap[$type]}(\$this->{$field['Field']});\n\t\t} else {\n\t\t\treturn null;\n\t\t}\n\t}\n"; } else { - $getters[] = "\t/**\n\t * Returns the value of field {$field['Field']}\n\t * @return $type\n\t */\n\tpublic function get$setterName(){\n\t\treturn \$this->{$field['Field']};\n\t}\n"; + $getters[] = "\t/**\n\t * Returns the value of field {$field['Field']}\n\n\t * @return $type\n\t */\n\tpublic function get$setterName(){\n\t\treturn \$this->{$field['Field']};\n\t}\n"; } } else { - $attributes[] = "\t/**\n\t * @var $type\n\t */\n\tpublic \${$field['Field']};\n"; + $attributes[] = "\t/**\n\n\t * @var $type\n\t */\n\tpublic \${$field['Field']};\n"; } } @@ -289,16 +289,17 @@ public function build(){ if($genDocMethods){ $code.="\n\t/**\n\t * @return ".$this->_options['className']."[]\n\t */\n"; - $code.="\tstatic public function find(\$parameters=array()){\n"; + $code.="\tpublic static function find(\$parameters=array()){\n"; $code.="\t\treturn parent::find(\$parameters);\n"; $code.="\t}\n\n"; $code.="\n\t/**\n\t * @return ".$this->_options['className']."\n\t */\n"; - $code.="\tstatic public function findFirst(\$parameters=array()){\n"; + $code.="\tpublic static function findFirst(\$parameters=array()){\n"; $code.="\t\treturn parent::findFirst(\$parameters);\n"; $code.="\t}\n\n"; } - $code.="}\n\n"; + $code.="}\n"; + $code = str_replace("\t", " ", $code); file_put_contents($path.$modelsDir."/".$this->_options['className'].".php", $code); } diff --git a/scripts/Builder/Components/Scaffold.php b/scripts/Builder/Components/Scaffold.php index d6fffbaa0..0aa1caf67 100755 --- a/scripts/Builder/Components/Scaffold.php +++ b/scripts/Builder/Components/Scaffold.php @@ -391,7 +391,7 @@ private function _makeController($path, $options){ }'.PHP_EOL.PHP_EOL; $code .= "".'}'.PHP_EOL; - + $code = str_replace("\t", " ", $code); file_put_contents($controllerPath, $code); } @@ -429,6 +429,7 @@ private function _makeLayouts($path, $options){ } $code.="\t".'getContent(); ?>'.PHP_EOL. ''; + $code = str_replace("\t", " ", $code); file_put_contents($viewPath, $code); } @@ -527,6 +528,7 @@ private function _makeFields($path, $options, $action){ } $code.=PHP_EOL."\t\t".''.PHP_EOL; } + $code = str_replace("\t", " ", $code); return $code; } @@ -575,6 +577,7 @@ private function _makeViewIndex($path, $options){ ''; //index.phtml + $code = str_replace("\t", " ", $code); file_put_contents($viewPath, $code); } @@ -623,6 +626,7 @@ private function _makeViewNew($path, $options){ "\t".''.PHP_EOL; //index.phtml + $code = str_replace("\t", " ", $code); file_put_contents($viewPath, $code); } } @@ -672,6 +676,7 @@ private function _makeViewEdit($path, $options){ "\t".''.PHP_EOL; //index.phtml + $code = str_replace("\t", " ", $code); file_put_contents($viewPath, $code); } @@ -763,6 +768,7 @@ private function _makeViewSearch($path, $options){ "\t\t".''.PHP_EOL. "\t".''.PHP_EOL. ''; + $code = str_replace("\t", " ", $code); file_put_contents($viewPath, $code); } } diff --git a/scripts/Model/Migration.php b/scripts/Model/Migration.php index 280189def..699470c72 100755 --- a/scripts/Model/Migration.php +++ b/scripts/Model/Migration.php @@ -117,6 +117,10 @@ public static function generate($version, $table, $exportData=null){ case 'datetime': $fieldDefinition[] = "'type' => Column::TYPE_DATETIME"; break; + case 'float': + $fieldDefinition[] = "'type' => Column::TYPE_DECIMAL"; + $numericFields[$field['Field']] = true; + break; case 'decimal': $fieldDefinition[] = "'type' => Column::TYPE_DECIMAL"; $numericFields[$field['Field']] = true; @@ -254,6 +258,7 @@ class ".$className." extends Phalcon_Model_Migration {\n\n". $classData.="\n\t}"; } $classData.="\n\n}"; + $classData = str_replace("\t", " ", $classData); return $classData; }