No data was sent by server

Asked

Viewed 1,005 times

0

When trying to access my route default in the browser is shown the error of the browser itself, in the case of Opera:

The dev.local page is not working

No data was sent by dev.local

In the case, dev.place is my local server. I have identified where the error is, but I don’t know why or how to fix 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();

At the core, the chunk of the code that is showing 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’s the 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 no error is pointed out, I found that the error is in the file database.php, in giving new Migration(), when I delete from that line until the end of the file the site works.

But the strange thing is that by putting one new Migration() in my index.php the class works normally, and before it worked, from nothing stopped working. What can 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.

1 answer

0


After trying so hard, I was blacked out the class Migration and created only one __construct, so it worked, then I came back with the contents of the whole class and added a __construct empty in class, like this:

public function __construct() {}

And so it worked, I don’t know why, but it worked.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.