Restructure Flarum\Database namespace

This commit is contained in:
Franz Liedke 2017-06-24 11:34:29 +02:00
parent cc653412a1
commit 925ef227a3
5 changed files with 35 additions and 12 deletions

View File

@ -16,7 +16,7 @@ use Flarum\Debug\Console\CacheClearCommand;
use Flarum\Debug\Console\InfoCommand; use Flarum\Debug\Console\InfoCommand;
use Flarum\Foundation\AbstractServer; use Flarum\Foundation\AbstractServer;
use Flarum\Install\Console\InstallCommand; use Flarum\Install\Console\InstallCommand;
use Flarum\Update\Console\MigrateCommand; use Flarum\Database\Console\MigrateCommand;
use Symfony\Component\Console\Application; use Symfony\Component\Console\Application;
class Server extends AbstractServer class Server extends AbstractServer

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Flarum\Update\Console; namespace Flarum\Database\Console;
use Flarum\Console\AbstractCommand; use Flarum\Console\AbstractCommand;
use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Container\Container;

View File

@ -12,7 +12,6 @@
namespace Flarum\Database; namespace Flarum\Database;
use Flarum\Foundation\AbstractServiceProvider; use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
use Illuminate\Database\ConnectionResolver; use Illuminate\Database\ConnectionResolver;
use Illuminate\Database\Connectors\ConnectionFactory; use Illuminate\Database\Connectors\ConnectionFactory;
use PDO; use PDO;
@ -46,14 +45,6 @@ class DatabaseServiceProvider extends AbstractServiceProvider
}); });
$this->app->alias('Illuminate\Database\ConnectionResolverInterface', 'db'); $this->app->alias('Illuminate\Database\ConnectionResolverInterface', 'db');
$this->app->singleton('Flarum\Database\MigrationRepositoryInterface', function ($app) {
return new DatabaseMigrationRepository($app['db'], 'migrations');
});
$this->app->bind(MigrationCreator::class, function (Application $app) {
return new MigrationCreator($app->make('Illuminate\Filesystem\Filesystem'), $app->basePath());
});
} }
/** /**

View File

@ -0,0 +1,32 @@
<?php
/*
* This file is part of Flarum.
*
* (c) Toby Zerner <toby.zerner@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Flarum\Database;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
class MigrationServiceProvider extends AbstractServiceProvider
{
/**
* {@inheritdoc}
*/
public function register()
{
$this->app->singleton('Flarum\Database\MigrationRepositoryInterface', function ($app) {
return new DatabaseMigrationRepository($app['db'], 'migrations');
});
$this->app->bind(MigrationCreator::class, function (Application $app) {
return new MigrationCreator($app->make('Illuminate\Filesystem\Filesystem'), $app->basePath());
});
}
}

View File

@ -14,7 +14,7 @@ namespace Flarum\Update\Controller;
use Exception; use Exception;
use Flarum\Foundation\Application; use Flarum\Foundation\Application;
use Flarum\Http\Controller\ControllerInterface; use Flarum\Http\Controller\ControllerInterface;
use Flarum\Update\Console\MigrateCommand; use Flarum\Database\Console\MigrateCommand;
use Psr\Http\Message\ServerRequestInterface as Request; use Psr\Http\Message\ServerRequestInterface as Request;
use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Output\StreamOutput;