Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PluginManager から $app を削除, Abstract メソッド追加 #3707

Merged
merged 2 commits into from
Aug 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 54 additions & 12 deletions src/Eccube/Plugin/AbstractPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,64 @@

use Doctrine\DBAL\Migrations\Configuration\Configuration;
use Doctrine\DBAL\Migrations\Migration;
use Symfony\Component\DependencyInjection\ContainerInterface;

class AbstractPluginManager
abstract class AbstractPluginManager
{
const MIGRATION_TABLE_PREFIX = 'migration_';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIGRATION_TABLE_PREFIX も不要かと思います。


public function migrationSchema($app, $migrationFilePath, $pluginCode, $version = null)
/**
* Install the plugin.
*
* @param array $meta
* @param ContainerInterface $container
*/
public function install(array $meta, ContainerInterface $container)
{
$config = new Configuration($app['db']);
$config->setMigrationsNamespace('DoctrineMigrations');
$config->setMigrationsDirectory($migrationFilePath);
$config->registerMigrationsFromDirectory($migrationFilePath);
$config->setMigrationsTableName(self::MIGRATION_TABLE_PREFIX.$pluginCode);
$migration = new Migration($config);
$migration->setNoMigrationException(true);
// null 又は 'last' を渡すと最新バージョンまでマイグレートする
// 0か'first'を渡すと最初に戻る
$migration->migrate($version, false);
// quiet.
}

/**
* Update the plugin.
*
* @param array $meta
* @param ContainerInterface $container
*/
public function update(array $meta, ContainerInterface $container)
{
// quiet.
}

/**
* Enable the plugin.
*
* @param array $meta
* @param ContainerInterface $container
*/
public function enable(array $meta, ContainerInterface $container)
{
// quiet.
}

/**
* Disable the plugin.
*
* @param array $meta
* @param ContainerInterface $container
*/
public function disable(array $meta, ContainerInterface $container)
{
// quiet.
}

/**
* Uninstall the plugin.
*
* @param array $meta
* @param ContainerInterface $container
*/
public function uninstall(array $meta, ContainerInterface $container)
{
// quiet.
}
}
9 changes: 1 addition & 8 deletions src/Eccube/Service/PluginService.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
use Doctrine\Common\Collections\Criteria;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\EntityManagerInterface;
use Eccube\Application;
use Eccube\Common\Constant;
use Eccube\Common\EccubeConfig;
use Eccube\Entity\Plugin;
Expand Down Expand Up @@ -45,11 +44,6 @@ class PluginService
*/
protected $pluginRepository;

/**
* @var Application
*/
protected $app;

/**
* @var EntityProxyService
*/
Expand Down Expand Up @@ -446,8 +440,7 @@ public function callPluginManagerMethod($meta, $method)
if (class_exists($class)) {
$installer = new $class(); // マネージャクラスに所定のメソッドがある場合だけ実行する
if (method_exists($installer, $method)) {
// FIXME appを削除.
$installer->$method($meta, $this->app, $this->container);
$installer->$method($meta, $this->container);
}
}
}
Expand Down