aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/InstallCommand.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-30 21:01:36 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-30 21:01:36 +0200
commitca17abce2d3963e266bee905ab084ddfa7e1ff18 (patch)
treece33b43a21acc99300d7046387f99d437f713785 /src/Wallabag/CoreBundle/Command/InstallCommand.php
parent114c55c0a6eade2ba6c53fe25f61cc58cca91620 (diff)
downloadwallabag-ca17abce2d3963e266bee905ab084ddfa7e1ff18.tar.gz
wallabag-ca17abce2d3963e266bee905ab084ddfa7e1ff18.tar.zst
wallabag-ca17abce2d3963e266bee905ab084ddfa7e1ff18.zip
Create user config in one place
Using a listener, user config is now created when a user: - is created from the command line - register (with or without email confirmation) - is created from the config panel
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 3873d2d3..cc7c2c94 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -2,6 +2,8 @@
2 2
3namespace Wallabag\CoreBundle\Command; 3namespace Wallabag\CoreBundle\Command;
4 4
5use FOS\UserBundle\Event\UserEvent;
6use FOS\UserBundle\FOSUserEvents;
5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; 7use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6use Symfony\Component\Console\Helper\Table; 8use Symfony\Component\Console\Helper\Table;
7use Symfony\Component\Console\Input\ArrayInput; 9use Symfony\Component\Console\Input\ArrayInput;
@@ -236,14 +238,9 @@ class InstallCommand extends ContainerAwareCommand
236 238
237 $em->persist($user); 239 $em->persist($user);
238 240
239 $config = new Config($user); 241 // dispatch a created event so the associated config will be created
240 $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme')); 242 $event = new UserEvent($user);
241 $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page')); 243 $this->getContainer()->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event);
242 $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
243 $config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed'));
244 $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
245
246 $em->persist($config);
247 244
248 $this->defaultOutput->writeln(''); 245 $this->defaultOutput->writeln('');
249 246