mirror of
https://github.com/flarum/framework.git
synced 2024-12-02 15:03:44 +08:00
Restructure Flarum\Database namespace
This commit is contained in:
parent
cc653412a1
commit
925ef227a3
|
@ -16,7 +16,7 @@ use Flarum\Debug\Console\CacheClearCommand;
|
|||
use Flarum\Debug\Console\InfoCommand;
|
||||
use Flarum\Foundation\AbstractServer;
|
||||
use Flarum\Install\Console\InstallCommand;
|
||||
use Flarum\Update\Console\MigrateCommand;
|
||||
use Flarum\Database\Console\MigrateCommand;
|
||||
use Symfony\Component\Console\Application;
|
||||
|
||||
class Server extends AbstractServer
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Update\Console;
|
||||
namespace Flarum\Database\Console;
|
||||
|
||||
use Flarum\Console\AbstractCommand;
|
||||
use Illuminate\Contracts\Container\Container;
|
|
@ -12,7 +12,6 @@
|
|||
namespace Flarum\Database;
|
||||
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Foundation\Application;
|
||||
use Illuminate\Database\ConnectionResolver;
|
||||
use Illuminate\Database\Connectors\ConnectionFactory;
|
||||
use PDO;
|
||||
|
@ -46,14 +45,6 @@ class DatabaseServiceProvider extends AbstractServiceProvider
|
|||
});
|
||||
|
||||
$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());
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
32
framework/core/src/Database/MigrationServiceProvider.php
Normal file
32
framework/core/src/Database/MigrationServiceProvider.php
Normal 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());
|
||||
});
|
||||
}
|
||||
}
|
|
@ -14,7 +14,7 @@ namespace Flarum\Update\Controller;
|
|||
use Exception;
|
||||
use Flarum\Foundation\Application;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Update\Console\MigrateCommand;
|
||||
use Flarum\Database\Console\MigrateCommand;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Symfony\Component\Console\Input\StringInput;
|
||||
use Symfony\Component\Console\Output\StreamOutput;
|
||||
|
|
Loading…
Reference in New Issue
Block a user