Fixing Merge conflicts
This commit is contained in:
@@ -15,7 +15,8 @@ class GeneratorController {
|
||||
<?php
|
||||
|
||||
use Schema\Wrapper as Wrapper;
|
||||
|
||||
use \App\Core\Sanity\MigratorController as Migrator;
|
||||
|
||||
function {{PLUGIN_NAME}}_upgrade(\$pluginversion) {
|
||||
if (\$pluginversion < "0.0.1") {
|
||||
\$table = Wrapper::get_table("{{PLUGIN_NAME}}");
|
||||
@@ -26,20 +27,20 @@ class GeneratorController {
|
||||
\$table->addSoftDelete();
|
||||
\$table->create();
|
||||
|
||||
Migrator::getInstance()->update_plugin_version("{{PLUGIN_NAME}}", "1.0.0");
|
||||
Migrator::getInstance()->update_plugin_version("{{SUB_PLUGIN_NAME}}_{{PLUGIN_NAME}}", "1.0.0");
|
||||
return;
|
||||
}
|
||||
|
||||
//if (\$pluginversion < "0.0.2") {
|
||||
//\$table = Wrapper::get_table("{{PLUGIN_NAME}}");
|
||||
//Migrator::getInstance()->update_plugin_version("{{PLUGIN_NAME}}", "1.0.1");
|
||||
//Migrator::getInstance()->update_plugin_version("{{SUB_PLUGIN_NAME}}_{{PLUGIN_NAME}}", "1.0.1");
|
||||
//return;
|
||||
//}
|
||||
}
|
||||
|
||||
function {{PLUGIN_NAME}}_rollback(\$pluginversion) {
|
||||
if(\$pluginversion > "0.0.1"){
|
||||
\$table = Wrapper::get_table("{{PLUGIN_NAME}}");
|
||||
\$table = Wrapper::get_table("{{SUB_PLUGIN_NAME}}_{{PLUGIN_NAME}}");
|
||||
\$table->drop();
|
||||
return;
|
||||
}
|
||||
@@ -62,8 +63,8 @@ class GeneratorController {
|
||||
|
||||
namespace {{NAMESPACE}};
|
||||
|
||||
use \{{NAMESPACE}}\Classes\{{OBJECT}} as {{OBJECT}};
|
||||
use \App\Core\Template\Output as Output;
|
||||
use \{{NAMESPACE}}\Classes\{{OBJECT}} as {{OBJECT}};
|
||||
|
||||
class {{CONTROLLER}} {
|
||||
|
||||
@@ -88,7 +89,8 @@ class GeneratorController {
|
||||
|
||||
/**
|
||||
* Create
|
||||
* Render the main {{OBJECT}} formular
|
||||
*
|
||||
* Render the main {{OBJECT}} formulary
|
||||
*/
|
||||
function create(){
|
||||
Output::setView('form', ['id' => 0]);
|
||||
@@ -97,7 +99,8 @@ class GeneratorController {
|
||||
|
||||
/**
|
||||
* Store
|
||||
* Store the param on the database
|
||||
*
|
||||
* Store the param on the database
|
||||
* @param {{OBJECT}} \${{OBJECT_LOWER}}
|
||||
*/
|
||||
function store({{OBJECT}} \${{OBJECT_LOWER}}){
|
||||
@@ -106,7 +109,8 @@ class GeneratorController {
|
||||
|
||||
/**
|
||||
* Show
|
||||
* Render one register
|
||||
*
|
||||
* Render one register
|
||||
*
|
||||
* @param {{OBJECT}} \${{OBJECT_LOWER}}
|
||||
*/
|
||||
@@ -116,17 +120,19 @@ class GeneratorController {
|
||||
|
||||
/**
|
||||
* Edit
|
||||
* Render the formular for a database {{OBJECT}}
|
||||
*
|
||||
* Render the formular for a database {{OBJECT}}
|
||||
*
|
||||
* @param {{OBJECT}} \${{OBJECT_LOWER}}
|
||||
*/
|
||||
function edit({{OBJECT}} \${{OBJECT_LOWER}}){
|
||||
|
||||
Output::setView('form', \${{OBJECT_LOWER}});
|
||||
Output::render();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update
|
||||
* Store the changes of the param on the database
|
||||
* Store the changes of the param on the database
|
||||
*
|
||||
* @param {{OBJECT}} \${{OBJECT_LOWER}}
|
||||
*/
|
||||
@@ -136,16 +142,17 @@ class GeneratorController {
|
||||
|
||||
/**
|
||||
* Destroy
|
||||
* If the object has soft delete.
|
||||
* If the object has soft delete.
|
||||
*
|
||||
* @param {{OBJECT}} \${{OBJECT_LOWER}}
|
||||
*/
|
||||
function destroy({{OBJECT}} \${{OBJECT_LOWER}}){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Purge
|
||||
* Remove object even with soft delete.
|
||||
* Remove object even with soft delete.
|
||||
*
|
||||
* @param {{OBJECT}} \${{OBJECT_LOWER}}
|
||||
*/
|
||||
@@ -230,11 +237,11 @@ class GeneratorController {
|
||||
private $formTemplate =
|
||||
<<<EOL
|
||||
{{@ if( {{id}} ): @}}
|
||||
<form method="POST" action="{{ENDPOINT}}/{{id}}/edit">
|
||||
<form method="POST" action="/{{ENDPOINT}}/{{id}}/edit">
|
||||
<input type="hidden" name="id" value="{{id}}" />
|
||||
<input type="hidden" name="_method" value="put" />
|
||||
{{@ else: @}}
|
||||
<form method="POST" action="{{ENDPOINT}}">
|
||||
<form method="POST" action="/{{ENDPOINT}}">
|
||||
<input type="hidden" name="id" value="" />
|
||||
{{@ endif; @}}
|
||||
|
||||
@@ -266,7 +273,7 @@ class GeneratorController {
|
||||
mkdir(DIR_APP.$subname . "/" . $name . "/db", 0755, true);
|
||||
mkdir(DIR_APP.$subname . "/" . $name . "/views", 0755, true);
|
||||
}
|
||||
|
||||
|
||||
$plugin_name = $name;
|
||||
$namespace = "App\\".ucfirst($subname)."\\".ucfirst($name);
|
||||
$plugin_name_pretty = ucwords(str_replace("_", " ", $name));
|
||||
@@ -278,7 +285,8 @@ class GeneratorController {
|
||||
file_put_contents(DIR_APP.$subname . "/" . $name . "/lang/en.php", $this->langBase);
|
||||
file_put_contents(DIR_APP.$subname . "/" . $name . "/lang/".APP_LANG.".php", $this->langBase);
|
||||
|
||||
$this->migrationBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->migrationBase);
|
||||
$this->migrationBase = str_replace("{{PLUGIN_NAME}}", $plugin_name, $this->migrationBase);
|
||||
$this->migrationBase = str_replace("{{SUB_PLUGIN_NAME}}", $subname, $this->migrationBase);
|
||||
file_put_contents(DIR_APP.$subname . "/" . $name . "/db/Migrate.php", $this->migrationBase);
|
||||
|
||||
$this->routeBase = str_replace("{{NAMESPACE}}", $namespace, $this->routeBase);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
|
||||
RouteCollection::cli('/', function(){
|
||||
echo "/core/create/[h:subname]/[h:name]\n";
|
||||
echo "/create/[h:subname]/[h:name]\n";
|
||||
});
|
||||
|
||||
RouteCollection::cli('/routes', '\App\Core\Generator\GeneratorController@listRoutes');
|
||||
|
||||
@@ -155,6 +155,16 @@ class MigratorController {
|
||||
$status = true;
|
||||
|
||||
foreach ($this->install as $key => $item) {
|
||||
/*
|
||||
*
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
$funname = explode('_', $item->name);
|
||||
if(sizeof($funname) > 1){ unset($funname[0]); }
|
||||
$funname = implode('_', $funname);
|
||||
|
||||
if (isset($item->require)) {
|
||||
if (!self::is_satisfy_array($item->require)) {
|
||||
$status = false;
|
||||
@@ -162,19 +172,22 @@ class MigratorController {
|
||||
}
|
||||
}
|
||||
if (!self::is_satisfy($item->name, $item->version)) {
|
||||
if (!function_exists($item->name . '_upgrade')) {
|
||||
if (!function_exists($funname . '_upgrade')) {
|
||||
echo 'adsdsadasdsadassad';
|
||||
$this->update_plugin_version($item->name, $item->version);
|
||||
$this->upgrade[] = $item;
|
||||
$this->instaled[$item->name] = $item;
|
||||
unset($this->install[$key]);
|
||||
continue;
|
||||
}
|
||||
call_user_func($item->name . '_upgrade', 0);
|
||||
$this->instaled[$item->name] = $item;
|
||||
call_user_func($funname . '_upgrade', '0');
|
||||
$this->upgrade[] = $this->instaled[$item->name];
|
||||
unset($this->install[$key]);
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
foreach ($this->upgrade as $item) {
|
||||
if (isset($item->require)) {
|
||||
if (!self::is_satisfy_array($item->require)) {
|
||||
@@ -182,12 +195,12 @@ class MigratorController {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (!self::is_satisfy($item->name, $item->version)) {
|
||||
if (!self::is_satisfy($funname, $item->version)) {
|
||||
if (!function_exists($item->name . '_upgrade')) {
|
||||
$this->update_plugin_version($item->name, $item->version);
|
||||
continue;
|
||||
}
|
||||
call_user_func($item->name . '_upgrade', $this->instaled[$item->name]->version);
|
||||
call_user_func($funname . '_upgrade', $this->instaled[$item->name]->version);
|
||||
$status = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +1,8 @@
|
||||
<?php
|
||||
|
||||
use RR\Response;
|
||||
use App\Core\Template\Output as Output;
|
||||
use Routes\RouteCollection as RouteCollection;
|
||||
use App\Core\Template\Output as Output;
|
||||
|
||||
RouteCollection::add('GET','/', function(){
|
||||
|
||||
Output::setTemplate('');
|
||||
Output::setView('welcome');
|
||||
Output::addValue('string', Array('welcome' => 'Bem vindo'));
|
||||
Output::addValue('palavrinha', 'Oi');
|
||||
Output::render();
|
||||
});
|
||||
|
||||
RouteCollection::get('/welcome', '\App\Core\Welcome\WelcomeController@welcome');
|
||||
|
||||
RouteCollection::add('get', '/', '\App\Core\Welcome\WelcomeController@welcome');
|
||||
//RouteCollection::add('get', '/welcome', 'WellcomeController@welcome');
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
|
||||
namespace App\Core\Welcome;
|
||||
|
||||
use RR\Response as R;
|
||||
use App\Core\Template\Output;
|
||||
|
||||
class WelcomeController{
|
||||
class WelcomeController {
|
||||
|
||||
function welcome(){
|
||||
R::json(Array('message' => \Lang::getString('welcome', 'welcome')))->send()->done();
|
||||
function welcome() {
|
||||
Output::render();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user