aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php16
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php4
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php3
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php3
-rw-r--r--src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php5
-rw-r--r--src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php5
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php8
-rw-r--r--src/Wallabag/UserBundle/EventListener/CreateConfigListener.php3
8 files changed, 20 insertions, 27 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 0d9364f6..d9608246 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -499,20 +499,18 @@ class InstallCommand extends ContainerAwareCommand
499 $output = new BufferedOutput(); 499 $output = new BufferedOutput();
500 $exitCode = $this->getApplication()->run(new ArrayInput($parameters), $output); 500 $exitCode = $this->getApplication()->run(new ArrayInput($parameters), $output);
501 501
502 // PDO does not always close the connection after Doctrine commands.
503 // See https://github.com/symfony/symfony/issues/11750.
504 $this->getContainer()->get('doctrine')->getManager()->getConnection()->close();
505
502 if (0 !== $exitCode) { 506 if (0 !== $exitCode) {
503 $this->getApplication()->setAutoExit(true); 507 $this->getApplication()->setAutoExit(true);
504 508
505 $this->defaultOutput->writeln(''); 509 throw new \RuntimeException(
506 $this->defaultOutput->writeln('<error>The command "'.$command.'" generates some errors: </error>'); 510 'The command "'.$command."\" generates some errors: \n\n"
507 $this->defaultOutput->writeln($output->fetch()); 511 .$output->fetch());
508
509 die();
510 } 512 }
511 513
512 // PDO does not always close the connection after Doctrine commands.
513 // See https://github.com/symfony/symfony/issues/11750.
514 $this->getContainer()->get('doctrine')->getManager()->getConnection()->close();
515
516 return $this; 514 return $this;
517 } 515 }
518 516
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 1a80cc1a..0e61c642 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -250,7 +250,7 @@ class ConfigController extends Controller
250 case 'entries': 250 case 'entries':
251 // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff 251 // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff
252 // otherwise they won't be removed ... 252 // otherwise they won't be removed ...
253 if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { 253 if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
254 $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId()); 254 $this->getDoctrine()->getRepository('WallabagAnnotationBundle:Annotation')->removeAllByUserId($this->getUser()->getId());
255 } 255 }
256 256
@@ -262,7 +262,7 @@ class ConfigController extends Controller
262 ->removeAllByUserId($this->getUser()->getId()); 262 ->removeAllByUserId($this->getUser()->getId());
263 break; 263 break;
264 case 'archived': 264 case 'archived':
265 if ($this->get('doctrine')->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver) { 265 if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
266 $this->removeAnnotationsForArchivedByUserId($this->getUser()->getId()); 266 $this->removeAnnotationsForArchivedByUserId($this->getUser()->getId());
267 } 267 }
268 268
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php
index 8d2ac6d4..9fe3e693 100644
--- a/src/Wallabag/CoreBundle/Controller/EntryController.php
+++ b/src/Wallabag/CoreBundle/Controller/EntryController.php
@@ -321,8 +321,7 @@ class EntryController extends Controller
321 321
322 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false); 322 $pagerAdapter = new DoctrineORMAdapter($qb->getQuery(), true, false);
323 323
324 $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries') 324 $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
325 ->prepare($pagerAdapter, $page);
326 325
327 try { 326 try {
328 $entries->setCurrentPage($page); 327 $entries->setCurrentPage($page);
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 736eb1dc..9422bae4 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -125,8 +125,7 @@ class TagController extends Controller
125 125
126 $pagerAdapter = new ArrayAdapter($entriesByTag); 126 $pagerAdapter = new ArrayAdapter($entriesByTag);
127 127
128 $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries') 128 $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare($pagerAdapter);
129 ->prepare($pagerAdapter, $page);
130 129
131 try { 130 try {
132 $entries->setCurrentPage($page); 131 $entries->setCurrentPage($page);
diff --git a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php
index 3b4c4cf9..5e6af8cc 100644
--- a/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php
+++ b/src/Wallabag/CoreBundle/Event/Subscriber/SQLiteCascadeDeleteSubscriber.php
@@ -45,9 +45,8 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber
45 public function preRemove(LifecycleEventArgs $args) 45 public function preRemove(LifecycleEventArgs $args)
46 { 46 {
47 $entity = $args->getEntity(); 47 $entity = $args->getEntity();
48 48 if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform
49 if (!$this->doctrine->getConnection()->getDriver() instanceof \Doctrine\DBAL\Driver\PDOSqlite\Driver || 49 || !$entity instanceof Entry) {
50 !$entity instanceof Entry) {
51 return; 50 return;
52 } 51 }
53 52
diff --git a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
index 7d3798b9..df579ebd 100644
--- a/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
+++ b/src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
@@ -20,16 +20,15 @@ class PreparePagerForEntries
20 20
21 /** 21 /**
22 * @param AdapterInterface $adapter 22 * @param AdapterInterface $adapter
23 * @param int $page
24 * 23 *
25 * @return null|Pagerfanta 24 * @return null|Pagerfanta
26 */ 25 */
27 public function prepare(AdapterInterface $adapter, $page = 1) 26 public function prepare(AdapterInterface $adapter)
28 { 27 {
29 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; 28 $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
30 29
31 if (null === $user || !is_object($user)) { 30 if (null === $user || !is_object($user)) {
32 return null; 31 return;
33 } 32 }
34 33
35 $entries = new Pagerfanta($adapter); 34 $entries = new Pagerfanta($adapter);
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index 1ff3046a..ed6ce331 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -64,7 +64,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
64 protected $email; 64 protected $email;
65 65
66 /** 66 /**
67 * @var date 67 * @var \DateTime
68 * 68 *
69 * @ORM\Column(name="created_at", type="datetime") 69 * @ORM\Column(name="created_at", type="datetime")
70 * 70 *
@@ -73,7 +73,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
73 protected $createdAt; 73 protected $createdAt;
74 74
75 /** 75 /**
76 * @var date 76 * @var \DateTime
77 * 77 *
78 * @ORM\Column(name="updated_at", type="datetime") 78 * @ORM\Column(name="updated_at", type="datetime")
79 * 79 *
@@ -157,7 +157,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
157 } 157 }
158 158
159 /** 159 /**
160 * @return string 160 * @return \DateTime
161 */ 161 */
162 public function getCreatedAt() 162 public function getCreatedAt()
163 { 163 {
@@ -165,7 +165,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
165 } 165 }
166 166
167 /** 167 /**
168 * @return string 168 * @return \DateTime
169 */ 169 */
170 public function getUpdatedAt() 170 public function getUpdatedAt()
171 { 171 {
diff --git a/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php b/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
index 0bdd1cae..e4d55c19 100644
--- a/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
+++ b/src/Wallabag/UserBundle/EventListener/CreateConfigListener.php
@@ -5,7 +5,6 @@ namespace Wallabag\UserBundle\EventListener;
5use Doctrine\ORM\EntityManager; 5use Doctrine\ORM\EntityManager;
6use FOS\UserBundle\Event\UserEvent; 6use FOS\UserBundle\Event\UserEvent;
7use FOS\UserBundle\FOSUserEvents; 7use FOS\UserBundle\FOSUserEvents;
8use Symfony\Component\EventDispatcher\EventDispatcherInterface;
9use Symfony\Component\EventDispatcher\EventSubscriberInterface; 8use Symfony\Component\EventDispatcher\EventSubscriberInterface;
10use Wallabag\CoreBundle\Entity\Config; 9use Wallabag\CoreBundle\Entity\Config;
11 10
@@ -47,7 +46,7 @@ class CreateConfigListener implements EventSubscriberInterface
47 ]; 46 ];
48 } 47 }
49 48
50 public function createConfig(UserEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null) 49 public function createConfig(UserEvent $event)
51 { 50 {
52 $config = new Config($event->getUser()); 51 $config = new Config($event->getUser());
53 $config->setTheme($this->theme); 52 $config->setTheme($this->theme);