From 1576905e0357ef96cd852ea3c1ff4216af195c34 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 8 Aug 2019 15:19:53 +0200 Subject: Rename internal settings table In fact it's not _just_ a rename. We are now able to use our own entity with the CraueConfigBundle which allow us to enforce a custom length on string field and avoid error with utf8mb4 on MySQL. To fix that issue before we were in need to fork CraueConfigBundle to hard apply these length changes. The recent 2.3.0 release fix that issue. That's why we are in need to rename the table (getting rid of the bundle name from it) Also updating deps: - Updating symfony/polyfill-mbstring (v1.11.0 => v1.12.0) - Updating symfony/polyfill-ctype (v1.11.0 => v1.12.0) - Updating symfony/polyfill-php70 (v1.11.0 => v1.12.0) - Updating symfony/polyfill-util (v1.11.0 => v1.12.0) - Updating symfony/polyfill-php56 (v1.11.0 => v1.12.0) - Updating symfony/polyfill-intl-icu (v1.11.0 => v1.12.0) - Updating symfony/polyfill-apcu (v1.11.0 => v1.12.0) - Updating j0k3r/graby-site-config (1.0.88 => 1.0.89) - Updating php-http/message (1.7.2 => 1.8.0) - Updating symfony/polyfill-php73 (v1.11.0 => v1.12.0) - Updating symfony/http-client (v4.3.2 => v4.3.3) - Updating symfony/polyfill-php72 (v1.11.0 => v1.12.0) - Updating symfony/polyfill-intl-idn (v1.11.0 => v1.12.0) - Updating symfony/mime (v4.3.2 => v4.3.3) - Updating craue/config-bundle (dev-utf8mb4 46cfd37 => 2.3.0) - Updating masterminds/html5 (2.6.0 => 2.7.0) - Updating nette/di (v3.0.0 => v3.0.1) - Updating symfony/polyfill-iconv (v1.11.0 => v1.12.0) - Updating wallabag/php-mobi (1.0.1 => 1.1.0) --- src/Wallabag/CoreBundle/Command/InstallCommand.php | 6 ++-- .../DataFixtures/InternalSettingFixtures.php | 38 ++++++++++++++++++++++ .../CoreBundle/DataFixtures/SettingFixtures.php | 38 ---------------------- src/Wallabag/CoreBundle/Entity/Config.php | 1 - src/Wallabag/CoreBundle/Entity/InternalSetting.php | 36 ++++++++++++++++++++ 5 files changed, 77 insertions(+), 42 deletions(-) create mode 100644 src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php delete mode 100644 src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php create mode 100644 src/Wallabag/CoreBundle/Entity/InternalSetting.php (limited to 'src') diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 50e19f0c..f73e0696 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -2,7 +2,6 @@ namespace Wallabag\CoreBundle\Command; -use Craue\ConfigBundle\Entity\Setting; use FOS\UserBundle\Event\UserEvent; use FOS\UserBundle\FOSUserEvents; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; @@ -13,6 +12,7 @@ use Symfony\Component\Console\Output\BufferedOutput; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; +use Wallabag\CoreBundle\Entity\InternalSetting; class InstallCommand extends ContainerAwareCommand { @@ -276,10 +276,10 @@ class InstallCommand extends ContainerAwareCommand $em = $this->getContainer()->get('doctrine.orm.entity_manager'); // cleanup before insert new stuff - $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); + $em->createQuery('DELETE FROM WallabagCoreBundle:InternalSetting')->execute(); foreach ($this->getContainer()->getParameter('wallabag_core.default_internal_settings') as $setting) { - $newSetting = new Setting(); + $newSetting = new InternalSetting(); $newSetting->setName($setting['name']); $newSetting->setValue($setting['value']); $newSetting->setSection($setting['section']); diff --git a/src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php b/src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php new file mode 100644 index 00000000..b052d1d5 --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/InternalSettingFixtures.php @@ -0,0 +1,38 @@ +container = $container; + } + + /** + * {@inheritdoc} + */ + public function load(ObjectManager $manager) + { + foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) { + $newSetting = new InternalSetting(); + $newSetting->setName($setting['name']); + $newSetting->setValue($setting['value']); + $newSetting->setSection($setting['section']); + $manager->persist($newSetting); + } + + $manager->flush(); + } +} diff --git a/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php b/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php deleted file mode 100644 index cc7d1f59..00000000 --- a/src/Wallabag/CoreBundle/DataFixtures/SettingFixtures.php +++ /dev/null @@ -1,38 +0,0 @@ -container = $container; - } - - /** - * {@inheritdoc} - */ - public function load(ObjectManager $manager) - { - foreach ($this->container->getParameter('wallabag_core.default_internal_settings') as $setting) { - $newSetting = new Setting(); - $newSetting->setName($setting['name']); - $newSetting->setValue($setting['value']); - $newSetting->setSection($setting['section']); - $manager->persist($newSetting); - } - - $manager->flush(); - } -} diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index 5181d91d..35be9655 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -17,7 +17,6 @@ use Wallabag\UserBundle\Entity\User; * @ORM\Index(name="config_feed_token", columns={"feed_token"}, options={"lengths"={255}}), * } * ) - * @ORM\Entity */ class Config { diff --git a/src/Wallabag/CoreBundle/Entity/InternalSetting.php b/src/Wallabag/CoreBundle/Entity/InternalSetting.php new file mode 100644 index 00000000..df8bd3be --- /dev/null +++ b/src/Wallabag/CoreBundle/Entity/InternalSetting.php @@ -0,0 +1,36 @@ +