No data was submitted by server

0

When I try to access my default route in the browser it is shown the error of the browser itself, in this case Opera:

  

The local dev page is not working

     

No data was sent by dev.local

In case, dev.local is my local server. I have identified where it is giving the error, but I do not know why or how to solve it.

In my index.php I have the code:

<?php

require_once __DIR__.'/../vendor/autoload.php';

// Chamo o núcleo do meu framework
new \LegionLab\Troubadour\Core();

In the core, the snippet of code that is displaying the error is this:

namespace LegionLab\Troubadour;

use LegionLab\Troubadour\Control\Errors;
use LegionLab\Troubadour\Collections\Session;
use LegionLab\Troubadour\Collections\Settings;
use LegionLab\Troubadour\Development\Security;
use LegionLab\Troubadour\Routes\Alias;
use LegionLab\Troubadour\Routes\Access;
use LegionLab\Troubadour\Collections\Saved;
.
.
.    
private function importKernelUtil()
{

    require_once ROOT."settings/alias.php";
    require_once "dispenser.php";

    Session::create();
    require_once ROOT."settings/setups.php";

    // Eis o if que chama um arquivo de migration, é nesse arquivo que está o problema..
    if(Settings::get('deployment'))
        require_once ROOT."settings/database.php";

    Security::errors();

    require_once ROOT."settings/access.php";
}

And finally, here is database.php , responsible for my migration :

<?php

use LegionLab\Troubadour\Persistence\Migration;
use LegionLab\Troubadour\Collections\Settings;

$table = new Migration();

$table
    ->database(Settings::get('default_dbname'))
    ->name('authors')
    ->column('id','int', 11, false)
    ->pk('id')
    ->autoincrement('id')
    ->column('name', 'varchar', 50, false)
    ->column('age', 'int', 3)
    ->make();

$table
    ->clear()
    ->database(Settings::get('default_dbname'))
    ->name('books')
    ->column('id','int', 11, false)
    ->pk('id')
    ->autoincrement('id')
    ->column('name', 'varchar', 50, false)
    ->column('price', 'double', 0)
    ->column('author', 'int', 11, false)
    ->addFK('author', array('authors', 'id'))
    ->make();

Using the PHPStorm is not pointed out any error, I discovered that the error is in file database.php , giving new Migration() , when I delete that line to the end of the file the site works.

But the strange thing is that by putting a new Migration() in my index.php the class works normally, and before it worked, nothing has stopped working. What can it be?

You can test with the composer command:

composer create-project --prefer-dist legionlab/troubadour-example nome-do-projeto

Changing the /settings/setups.php file with your database settings.

    
asked by anonymous 23.10.2016 / 00:20

1 answer

0

After trying so much, I deleted the Migration class and created only __construct , so it worked, so I came back with the contents of the whole class and added% void% to the class, like this:

public function __construct() {}

And so it worked, I do not know why, but it worked.

    
23.10.2016 / 03:27