X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=app%2FDoctrineMigrations%2FVersion20170602075214.php;h=12997c7153e070a06e611337b073ce49ce3b2b3f;hb=bfe7a692261760517199a3797191fd214fc2ee6c;hp=451d16bae34a615de26eae7223cea49bfb67485b;hpb=c0d756f67d1cc0fc6832d404a09729f9219f0595;p=github%2Fwallabag%2Fwallabag.git diff --git a/app/DoctrineMigrations/Version20170602075214.php b/app/DoctrineMigrations/Version20170602075214.php index 451d16ba..12997c71 100644 --- a/app/DoctrineMigrations/Version20170602075214.php +++ b/app/DoctrineMigrations/Version20170602075214.php @@ -2,31 +2,14 @@ namespace Application\Migrations; -use Doctrine\DBAL\Migrations\AbstractMigration; use Doctrine\DBAL\Schema\Schema; -use Symfony\Component\DependencyInjection\ContainerAwareInterface; -use Symfony\Component\DependencyInjection\ContainerInterface; +use Wallabag\CoreBundle\Doctrine\WallabagMigration; /** * Add api_user_registration in craue_config_setting. */ -class Version20170602075214 extends AbstractMigration implements ContainerAwareInterface +class Version20170602075214 extends WallabagMigration { - /** - * @var ContainerInterface - */ - private $container; - - public function setContainer(ContainerInterface $container = null) - { - $this->container = $container; - } - - private function getTable($tableName) - { - return $this->container->getParameter('database_table_prefix').$tableName; - } - /** * @param Schema $schema */ @@ -35,11 +18,11 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI $apiUserRegistration = $this->container ->get('doctrine.orm.default_entity_manager') ->getConnection() - ->fetchArray('SELECT * FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration'"); + ->fetchArray('SELECT * FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration'"); $this->skipIf(false !== $apiUserRegistration, 'It seems that you already played this migration.'); - $this->addSql('INSERT INTO '.$this->getTable('craue_config_setting')." (name, value, section) VALUES ('api_user_registration', '0', 'api')"); + $this->addSql('INSERT INTO ' . $this->getTable('craue_config_setting') . " (name, value, section) VALUES ('api_user_registration', '0', 'api')"); } /** @@ -47,6 +30,6 @@ class Version20170602075214 extends AbstractMigration implements ContainerAwareI */ public function down(Schema $schema) { - $this->addSql('DELETE FROM '.$this->getTable('craue_config_setting')." WHERE name = 'api_user_registration';"); + $this->addSql('DELETE FROM ' . $this->getTable('craue_config_setting') . " WHERE name = 'api_user_registration';"); } }