This commit is contained in:
Jeremy Benoist 2022-11-23 15:51:33 +01:00
parent af6363bbbd
commit b7dba18cb2
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
41 changed files with 285 additions and 950 deletions

View file

@ -1,55 +1,10 @@
parameters: parameters:
ignoreErrors: ignoreErrors:
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagAnnotationBundle\\:Annotation\\>\\:\\:findAnnotationsByPageId\\(\\)\\.$#"
count: 1
path: src/Wallabag/AnnotationBundle/Controller/WallabagAnnotationController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagApiBundle\\:Client\\>\\:\\:findByUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Controller/DeveloperController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findByUserIdAndBatchHashedUrls\\(\\)\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Controller/EntryRestController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Tag\\>\\:\\:findOneByLabel\\(\\)\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Controller/EntryRestController.php
- -
message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#"
count: 2 count: 2
path: src/Wallabag/ApiBundle/Controller/EntryRestController.php path: src/Wallabag/ApiBundle/Controller/EntryRestController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:removeTag\\(\\)\\.$#"
count: 2
path: src/Wallabag/ApiBundle/Controller/TagRestController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:removeTags\\(\\)\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Controller/TagRestController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Tag\\>\\:\\:findAllTags\\(\\)\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Controller/TagRestController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Tag\\>\\:\\:findByLabelsAndUser\\(\\)\\.$#"
count: 3
path: src/Wallabag/ApiBundle/Controller/TagRestController.php
-
message: "#^Call to an undefined method FOS\\\\UserBundle\\\\Model\\\\UserInterface\\:\\:addClient\\(\\)\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Controller/UserRestController.php
- -
message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#"
count: 1 count: 1
@ -60,471 +15,41 @@ parameters:
count: 3 count: 3
path: src/Wallabag/ApiBundle/Controller/WallabagRestController.php path: src/Wallabag/ApiBundle/Controller/WallabagRestController.php
-
message: "#^Cannot call method getId\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 2
path: src/Wallabag/ApiBundle/Controller/WallabagRestController.php
-
message: "#^Property Wallabag\\\\ApiBundle\\\\Entity\\\\AccessToken\\:\\:\\$client has unknown class FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientInterface as its type\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Entity/AccessToken.php
-
message: "#^Property Wallabag\\\\ApiBundle\\\\Entity\\\\AccessToken\\:\\:\\$user has unknown class FOS\\\\OAuthServerBundle\\\\Entity\\\\UserInterface as its type\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Entity/AccessToken.php
-
message: "#^Property Wallabag\\\\ApiBundle\\\\Entity\\\\AuthCode\\:\\:\\$client has unknown class FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientInterface as its type\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Entity/AuthCode.php
-
message: "#^Property Wallabag\\\\ApiBundle\\\\Entity\\\\AuthCode\\:\\:\\$user has unknown class FOS\\\\OAuthServerBundle\\\\Entity\\\\UserInterface as its type\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Entity/AuthCode.php
-
message: "#^Property Wallabag\\\\ApiBundle\\\\Entity\\\\RefreshToken\\:\\:\\$client has unknown class FOS\\\\OAuthServerBundle\\\\Entity\\\\ClientInterface as its type\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Entity/RefreshToken.php
-
message: "#^Property Wallabag\\\\ApiBundle\\\\Entity\\\\RefreshToken\\:\\:\\$user has unknown class FOS\\\\OAuthServerBundle\\\\Entity\\\\UserInterface as its type\\.$#"
count: 1
path: src/Wallabag/ApiBundle/Entity/RefreshToken.php
-
message: "#^Service \"wallabag_core\\.entry\\.download_images\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/CleanDownloadedImagesCommand.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/CleanDownloadedImagesCommand.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ExportCommand.php
-
message: "#^Service \"wallabag_core\\.helper\\.entries_export\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ExportCommand.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ExportCommand.php
- -
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getConnection\\(\\)\\.$#" message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getConnection\\(\\)\\.$#"
count: 5 count: 5
path: src/Wallabag/CoreBundle/Command/InstallCommand.php path: src/Wallabag/CoreBundle/Command/InstallCommand.php
-
message: "#^Method Wallabag\\\\CoreBundle\\\\Command\\\\InstallCommand\\:\\:execute\\(\\) should return int\\|null but return statement is missing\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/InstallCommand.php
-
message: "#^Service \"fos_user\\.user_manager\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/InstallCommand.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Command/ListUserCommand.php
-
message: "#^Service \"wallabag_core\\.content_proxy\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ReloadEntryCommand.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/ShowUserCommand.php
-
message: "#^Service \"wallabag_core\\.rule_based_tagger\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/TagAllCommand.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Command/TagAllCommand.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagAnnotationBundle\\:Annotation\\>\\:\\:findAllArchivedEntriesByUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagAnnotationBundle\\:Annotation\\>\\:\\:removeAllByUserId\\(\\)\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Config\\>\\:\\:findOneByUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
- -
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#" message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Entity\\\\RuleInterface\\:\\:getConfig\\(\\)\\.$#"
count: 1 count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to method getConfig\\(\\) on an unknown class WallabagCoreBundle\\:IgnoreOriginUserRule\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to method getConfig\\(\\) on an unknown class WallabagCoreBundle\\:TaggingRule\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to method getId\\(\\) on an unknown class WallabagCoreBundle\\:IgnoreOriginUserRule\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to method getId\\(\\) on an unknown class WallabagCoreBundle\\:TaggingRule\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to method setConfig\\(\\) on an unknown class WallabagCoreBundle\\:IgnoreOriginUserRule\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to method setConfig\\(\\) on an unknown class WallabagCoreBundle\\:TaggingRule\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Service \"fos_user\\.user_manager\" is private\\.$#"
count: 7
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Service \"liip_theme\\.active_theme\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 3
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Service \"wallabag_core\\.tag_repository\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Service \"wallabag_user\\.user_repository\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Controller/ConfigController.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Repository\\\\EntryRepository\\:\\:findById\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/EntryController.php
-
message: "#^Service \"logger\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/EntryController.php
-
message: "#^Service \"wallabag_core\\.content_proxy\" is private\\.$#"
count: 3
path: src/Wallabag/CoreBundle/Controller/EntryController.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 6
path: src/Wallabag/CoreBundle/Controller/EntryController.php
-
message: "#^Service \"wallabag_core\\.helper\\.prepare_pager_for_entries\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/EntryController.php
-
message: "#^Service \"wallabag_core\\.helper\\.redirect\" is private\\.$#"
count: 4
path: src/Wallabag/CoreBundle/Controller/EntryController.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Repository\\\\TagRepository\\:\\:findOneBySlug\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ExportController.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ExportController.php
-
message: "#^Service \"wallabag_core\\.helper\\.entries_export\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Controller/ExportController.php
-
message: "#^Service \"wallabag_core\\.tag_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/ExportController.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Controller/FeedController.php
-
message: "#^Service \"wallabag_core\\.helper\\.prepare_pager_for_entries\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/FeedController.php
-
message: "#^Service \"wallabag_core\\.ignore_origin_instance_rule_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/IgnoreOriginInstanceRuleController.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Repository\\\\SiteCredentialRepository\\:\\:findByUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
-
message: "#^Service \"wallabag_core\\.helper\\.crypto_proxy\" is private\\.$#"
count: 4
path: src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
-
message: "#^Service \"wallabag_core\\.site_credential_repository\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
- -
message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#" message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#"
count: 1 count: 1
path: src/Wallabag/CoreBundle/Controller/StaticController.php path: src/Wallabag/CoreBundle/Controller/StaticController.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Repository\\\\TagRepository\\:\\:findOneByLabel\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/TagController.php
-
message: "#^Service \"wallabag_core\\.entry_repository\" is private\\.$#"
count: 5
path: src/Wallabag/CoreBundle/Controller/TagController.php
-
message: "#^Service \"wallabag_core\\.helper\\.prepare_pager_for_entries\" is private\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Controller/TagController.php
-
message: "#^Service \"wallabag_core\\.helper\\.redirect\" is private\\.$#"
count: 4
path: src/Wallabag/CoreBundle/Controller/TagController.php
-
message: "#^Service \"wallabag_core\\.tag_repository\" is private\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Controller/TagController.php
-
message: "#^Service \"wallabag_core\\.tags_assigner\" is private\\.$#"
count: 3
path: src/Wallabag/CoreBundle/Controller/TagController.php
-
message: "#^Service \"wallabag_core\\.helper\\.crypto_proxy\" is private\\.$#"
count: 4
path: src/Wallabag/CoreBundle/DataFixtures/SiteCredentialFixtures.php
- -
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1 count: 1
path: src/Wallabag/CoreBundle/DependencyInjection/Configuration.php path: src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
-
message: "#^Cannot call method getConfig\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Event/Listener/UserLocaleListener.php
- -
message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#" message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpressionBuilder\\(\\)\\.$#"
count: 1 count: 1
path: src/Wallabag/CoreBundle/Event/Subscriber/CustomDoctrineORMSubscriber.php path: src/Wallabag/CoreBundle/Event/Subscriber/CustomDoctrineORMSubscriber.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\:\\:findDistinctLanguageByUser\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
- -
message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpr\\(\\)\\.$#" message: "#^Call to an undefined method Lexik\\\\Bundle\\\\FormFilterBundle\\\\Filter\\\\Query\\\\QueryInterface\\:\\:getExpr\\(\\)\\.$#"
count: 10 count: 10
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
-
message: "#^Cannot call method getConfig\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
-
message: "#^Cannot call method getId\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php
-
message: "#^Cannot call method getConfig\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Helper/EntriesExport.php
-
message: "#^PHPDoc tag @var has invalid value \\(\\[\\\\GuzzleHttp\\\\Event\\\\SubscriberInterface\\]\\)\\: Unexpected token \"\\[\", expected type at offset 9$#"
count: 1
path: src/Wallabag/CoreBundle/Helper/HttpClientFactory.php
-
message: "#^Call to an undefined method Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Helper/PreparePagerForEntries.php
-
message: "#^Call to an undefined method Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Helper/Redirect.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Repository\\\\TagRepository\\:\\:findOneByLabel\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Helper/RuleBasedTagger.php
-
message: "#^Call to an undefined method Wallabag\\\\CoreBundle\\\\Repository\\\\TagRepository\\:\\:findOneByLabel\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/Helper/TagsAssigner.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<object\\>\\:\\:findOneByUsernameAndFeedtoken\\(\\)\\.$#"
count: 1
path: src/Wallabag/CoreBundle/ParamConverter/UsernameFeedTokenConverter.php
-
message: "#^Call to an undefined method Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getConfig\\(\\)\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Twig/WallabagExtension.php
-
message: "#^Call to an undefined method Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getCreatedAt\\(\\)\\.$#"
count: 2
path: src/Wallabag/CoreBundle/Twig/WallabagExtension.php
-
message: "#^Call to an undefined method Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\:\\:getId\\(\\)\\.$#"
count: 7
path: src/Wallabag/CoreBundle/Twig/WallabagExtension.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagUserBundle\\:User\\>\\:\\:findOneById\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagUserBundle\\:User\\>\\:\\:findOneByUsername\\(\\)\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
- -
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getConnection\\(\\)\\.$#" message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getConnection\\(\\)\\.$#"
count: 1 count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Method Wallabag\\\\ImportBundle\\\\Command\\\\ImportCommand\\:\\:execute\\(\\) should return int\\|null but return statement is missing\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.chrome\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.delicious\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.firefox\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.instapaper\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.pinboard\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.readability\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.wallabag_v1\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Service \"wallabag_import\\.wallabag_v2\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/ImportCommand.php
-
message: "#^Method Wallabag\\\\ImportBundle\\\\Command\\\\RedisWorkerCommand\\:\\:execute\\(\\) should return int\\|null but return statement is missing\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Command/RedisWorkerCommand.php
- -
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#" message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1 count: 1
@ -535,96 +60,6 @@ parameters:
count: 1 count: 1
path: src/Wallabag/ImportBundle/Controller/BrowserController.php path: src/Wallabag/ImportBundle/Controller/BrowserController.php
-
message: "#^Service \"wallabag_import\\.chrome\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ChromeController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.chrome\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ChromeController.php
-
message: "#^Service \"wallabag_import\\.delicious\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/DeliciousController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.delicious\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/DeliciousController.php
-
message: "#^Service \"wallabag_import\\.elcurator\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ElcuratorController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.elcurator\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ElcuratorController.php
-
message: "#^Service \"wallabag_import\\.firefox\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/FirefoxController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.firefox\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/FirefoxController.php
-
message: "#^Service \"wallabag_core\\.redis\\.client\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ImportController.php
-
message: "#^Service \"wallabag_import\\.chain\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ImportController.php
-
message: "#^Service \"wallabag_import\\.instapaper\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/InstapaperController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.instapaper\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/InstapaperController.php
-
message: "#^Service \"wallabag_import\\.pinboard\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/PinboardController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.pinboard\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/PinboardController.php
-
message: "#^Service \"wallabag_import\\.pocket\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/PocketController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.pocket\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/PocketController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.readability\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ReadabilityController.php
-
message: "#^Service \"wallabag_import\\.readability\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/ReadabilityController.php
- -
message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#" message: "#^Call to an undefined method Wallabag\\\\ImportBundle\\\\Import\\\\ImportInterface\\:\\:setFilepath\\(\\)\\.$#"
count: 1 count: 1
@ -635,186 +70,16 @@ parameters:
count: 1 count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagController.php path: src/Wallabag/ImportBundle/Controller/WallabagController.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.wallabag_v1\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
-
message: "#^Service \"wallabag_import\\.wallabag_v1\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagV1Controller.php
-
message: "#^Service \"wallabag_import\\.producer\\.redis\\.wallabag_v2\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
-
message: "#^Service \"wallabag_import\\.wallabag_v2\\.import\" is private\\.$#"
count: 1
path: src/Wallabag/ImportBundle/Controller/WallabagV2Controller.php
- -
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#" message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1 count: 1
path: src/Wallabag/ImportBundle/DependencyInjection/Configuration.php path: src/Wallabag/ImportBundle/DependencyInjection/Configuration.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagUserBundle\\:User\\>\\:\\:getQueryBuilderForSearch\\(\\)\\.$#"
count: 1
path: src/Wallabag/UserBundle/Controller/ManageController.php
-
message: "#^Service \"fos_user\\.user_manager\" is private\\.$#"
count: 2
path: src/Wallabag/UserBundle/Controller/ManageController.php
-
message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#"
count: 1
path: src/Wallabag/UserBundle/Controller/RegistrationController.php
-
message: "#^Call to an undefined method Psr\\\\Container\\\\ContainerInterface\\:\\:getParameter\\(\\)\\.$#"
count: 1
path: src/Wallabag/UserBundle/Controller/SecurityController.php
-
message: "#^Call to an undefined method Symfony\\\\Component\\\\Config\\\\Definition\\\\Builder\\\\NodeDefinition\\:\\:children\\(\\)\\.$#"
count: 1
path: src/Wallabag/UserBundle/DependencyInjection/Configuration.php
- -
message: "#^Call to an undefined method Scheb\\\\TwoFactorBundle\\\\Model\\\\Email\\\\TwoFactorInterface\\:\\:getName\\(\\)\\.$#" message: "#^Call to an undefined method Scheb\\\\TwoFactorBundle\\\\Model\\\\Email\\\\TwoFactorInterface\\:\\:getName\\(\\)\\.$#"
count: 2 count: 2
path: src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php path: src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagAnnotationBundle\\:Annotation\\>\\:\\:findAnnotationById\\(\\)\\.$#"
count: 1
path: tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagAnnotationBundle\\:Annotation\\>\\:\\:findLastAnnotationByPageId\\(\\)\\.$#"
count: 1
path: tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagAnnotationBundle\\:Annotation\\>\\:\\:findOneById\\(\\)\\.$#"
count: 2
path: tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findOneByUsernameAndNotArchived\\(\\)\\.$#"
count: 7
path: tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagUserBundle\\:User\\>\\:\\:findOneByUserName\\(\\)\\.$#"
count: 3
path: tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php
-
message: "#^PHPDoc tag @var has invalid value \\(\\$loginManager \\\\FOS\\\\UserBundle\\\\Security\\\\LoginManager\\)\\: Unexpected token \"\\$loginManager\", expected type at offset 9$#"
count: 1
path: tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
-
message: "#^PHPDoc tag @var has invalid value \\(\\$userManager \\\\FOS\\\\UserBundle\\\\Doctrine\\\\UserManager\\)\\: Unexpected token \"\\$userManager\", expected type at offset 9$#"
count: 1
path: tests/Wallabag/AnnotationBundle/WallabagAnnotationTestCase.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findByUrlAndUserId\\(\\)\\.$#"
count: 3
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findOneByUser\\(\\)\\.$#"
count: 7
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findOneWithTags\\(\\)\\.$#"
count: 2
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getId\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 10
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getOriginUrl\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 1
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getTags\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 3
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getTitle\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 4
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getUrl\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 3
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getUserEmail\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 1
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getUserId\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 1
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to method getUserName\\(\\) on an unknown class WallabagCoreBundle\\:Entry\\.$#"
count: 1
path: tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findAllByTagId\\(\\)\\.$#"
count: 4
path: tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Entry\\>\\:\\:findOneWithTags\\(\\)\\.$#"
count: 3
path: tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagCoreBundle\\:Tag\\>\\:\\:findOneByLabel\\(\\)\\.$#"
count: 2
path: tests/Wallabag/ApiBundle/Controller/TagRestControllerTest.php
-
message: "#^Call to an undefined method Doctrine\\\\ORM\\\\EntityRepository\\<WallabagUserBundle\\:User\\>\\:\\:findOneByUserName\\(\\)\\.$#"
count: 1
path: tests/Wallabag/ApiBundle/WallabagApiTestCase.php
-
message: "#^PHPDoc tag @var has invalid value \\(\\$loginManager \\\\FOS\\\\UserBundle\\\\Security\\\\LoginManager\\)\\: Unexpected token \"\\$loginManager\", expected type at offset 9$#"
count: 1
path: tests/Wallabag/ApiBundle/WallabagApiTestCase.php
-
message: "#^PHPDoc tag @var has invalid value \\(\\$userManager \\\\FOS\\\\UserBundle\\\\Doctrine\\\\UserManager\\)\\: Unexpected token \"\\$userManager\", expected type at offset 9$#"
count: 1
path: tests/Wallabag/ApiBundle/WallabagApiTestCase.php
-
message: "#^Cannot call method getId\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 9
path: tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php
- -
message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#" message: "#^Call to an undefined method DOMNode\\:\\:getAttribute\\(\\)\\.$#"
count: 1 count: 1
@ -825,11 +90,6 @@ parameters:
count: 2 count: 2
path: tests/Wallabag/CoreBundle/Helper/RedirectTest.php path: tests/Wallabag/CoreBundle/Helper/RedirectTest.php
-
message: "#^Cannot call method getConfig\\(\\) on string\\|Stringable\\|Symfony\\\\Component\\\\Security\\\\Core\\\\User\\\\UserInterface\\.$#"
count: 3
path: tests/Wallabag/CoreBundle/Helper/RedirectTest.php
- -
message: "#^Property Tests\\\\Wallabag\\\\CoreBundle\\\\Helper\\\\RedirectTest\\:\\:\\$routerMock has unknown class PHPUnit_Framework_MockObject_MockObject as its type\\.$#" message: "#^Property Tests\\\\Wallabag\\\\CoreBundle\\\\Helper\\\\RedirectTest\\:\\:\\$routerMock has unknown class PHPUnit_Framework_MockObject_MockObject as its type\\.$#"
count: 1 count: 1

View file

@ -14,3 +14,6 @@ parameters:
- vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php - vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php
inferPrivatePropertyTypeFromConstructor: true inferPrivatePropertyTypeFromConstructor: true
ignoreErrors:
- '#^Service ".+" is private\.?#'

View file

@ -52,7 +52,7 @@ class WallabagAnnotationController extends AbstractFOSRestController
{ {
$data = json_decode($request->getContent(), true); $data = json_decode($request->getContent(), true);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$annotation = new Annotation($this->getUser()); $annotation = new Annotation($this->getUser());
$annotation->setEntry($entry); $annotation->setEntry($entry);
@ -95,7 +95,7 @@ class WallabagAnnotationController extends AbstractFOSRestController
$form->submit($data); $form->submit($data);
if ($form->isValid()) { if ($form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($annotation); $em->persist($annotation);
$em->flush(); $em->flush();
@ -119,7 +119,7 @@ class WallabagAnnotationController extends AbstractFOSRestController
*/ */
public function deleteAnnotationAction(Annotation $annotation) public function deleteAnnotationAction(Annotation $annotation)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($annotation); $em->remove($annotation);
$em->flush(); $em->flush();

View file

@ -9,6 +9,8 @@ use Wallabag\AnnotationBundle\Entity\Annotation;
/** /**
* AnnotationRepository. * AnnotationRepository.
*
* @method Annotation|null findOneById(int $id)
*/ */
class AnnotationRepository extends ServiceEntityRepository class AnnotationRepository extends ServiceEntityRepository
{ {

View file

@ -23,7 +23,7 @@ class DeveloperController extends Controller
*/ */
public function indexAction() public function indexAction()
{ {
$clients = $this->getDoctrine()->getRepository(Client::class)->findByUser($this->getUser()->getId()); $clients = $this->get('doctrine')->getRepository(Client::class)->findByUser($this->getUser()->getId());
return $this->render('@WallabagCore/Developer/index.html.twig', [ return $this->render('@WallabagCore/Developer/index.html.twig', [
'clients' => $clients, 'clients' => $clients,
@ -39,7 +39,7 @@ class DeveloperController extends Controller
*/ */
public function createClientAction(Request $request) public function createClientAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$client = new Client($this->getUser()); $client = new Client($this->getUser());
$clientForm = $this->createForm(ClientType::class, $client); $clientForm = $this->createForm(ClientType::class, $client);
$clientForm->handleRequest($request); $clientForm->handleRequest($request);
@ -79,7 +79,7 @@ class DeveloperController extends Controller
throw $this->createAccessDeniedException('You can not access this client.'); throw $this->createAccessDeniedException('You can not access this client.');
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($client); $em->remove($client);
$em->flush(); $em->flush();

View file

@ -88,7 +88,7 @@ class EntryRestController extends WallabagRestController
public function getEntriesExistsAction(Request $request) public function getEntriesExistsAction(Request $request)
{ {
$this->validateAuthentication(); $this->validateAuthentication();
$repo = $this->getDoctrine()->getRepository(Entry::class); $repo = $this->get('doctrine')->getRepository(Entry::class);
$returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id'); $returnId = (null === $request->query->get('return_id')) ? false : (bool) $request->query->get('return_id');
@ -464,7 +464,7 @@ class EntryRestController extends WallabagRestController
// entry deleted, dispatch event about it! // entry deleted, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); $this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($entry); $em->remove($entry);
$em->flush(); $em->flush();
} }
@ -532,7 +532,7 @@ class EntryRestController extends WallabagRestController
$this->get(ContentProxy::class)->updateEntry($entry, $url); $this->get(ContentProxy::class)->updateEntry($entry, $url);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -755,7 +755,7 @@ class EntryRestController extends WallabagRestController
$this->get(ContentProxy::class)->setDefaultEntryTitle($entry); $this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -971,7 +971,7 @@ class EntryRestController extends WallabagRestController
$this->get(ContentProxy::class)->setDefaultEntryTitle($entry); $this->get(ContentProxy::class)->setDefaultEntryTitle($entry);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -1027,7 +1027,7 @@ class EntryRestController extends WallabagRestController
return new JsonResponse([], 304); return new JsonResponse([], 304);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -1085,7 +1085,7 @@ class EntryRestController extends WallabagRestController
// entry deleted, dispatch event about it! // entry deleted, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); $this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($entry); $em->remove($entry);
$em->flush(); $em->flush();
@ -1168,7 +1168,7 @@ class EntryRestController extends WallabagRestController
$this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags); $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags);
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -1213,7 +1213,7 @@ class EntryRestController extends WallabagRestController
$this->validateUserAccess($entry->getUser()->getId()); $this->validateUserAccess($entry->getUser()->getId());
$entry->removeTag($tag); $entry->removeTag($tag);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -1272,7 +1272,7 @@ class EntryRestController extends WallabagRestController
foreach ($tags as $label) { foreach ($tags as $label) {
$label = trim($label); $label = trim($label);
$tag = $this->getDoctrine() $tag = $this->get('doctrine')
->getRepository(Tag::class) ->getRepository(Tag::class)
->findOneByLabel($label); ->findOneByLabel($label);
@ -1281,7 +1281,7 @@ class EntryRestController extends WallabagRestController
} }
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
} }
@ -1340,7 +1340,7 @@ class EntryRestController extends WallabagRestController
if (false !== $entry && !(empty($tags))) { if (false !== $entry && !(empty($tags))) {
$this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags); $this->get(TagsAssigner::class)->assignTagsToEntry($entry, $tags);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
} }

View file

@ -33,7 +33,7 @@ class TagRestController extends WallabagRestController
{ {
$this->validateAuthentication(); $this->validateAuthentication();
$tags = $this->getDoctrine() $tags = $this->get('doctrine')
->getRepository(Tag::class) ->getRepository(Tag::class)
->findAllFlatTagsWithNbEntries($this->getUser()->getId()); ->findAllFlatTagsWithNbEntries($this->getUser()->getId());
@ -71,7 +71,7 @@ class TagRestController extends WallabagRestController
$this->validateAuthentication(); $this->validateAuthentication();
$label = $request->get('tag', ''); $label = $request->get('tag', '');
$tags = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser([$label], $this->getUser()->getId()); $tags = $this->get('doctrine')->getRepository(Tag::class)->findByLabelsAndUser([$label], $this->getUser()->getId());
if (empty($tags)) { if (empty($tags)) {
throw $this->createNotFoundException('Tag not found'); throw $this->createNotFoundException('Tag not found');
@ -79,7 +79,7 @@ class TagRestController extends WallabagRestController
$tag = $tags[0]; $tag = $tags[0];
$this->getDoctrine() $this->get('doctrine')
->getRepository(Entry::class) ->getRepository(Entry::class)
->removeTag($this->getUser()->getId(), $tag); ->removeTag($this->getUser()->getId(), $tag);
@ -122,13 +122,13 @@ class TagRestController extends WallabagRestController
$tagsLabels = $request->get('tags', ''); $tagsLabels = $request->get('tags', '');
$tags = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser(explode(',', $tagsLabels), $this->getUser()->getId()); $tags = $this->get('doctrine')->getRepository(Tag::class)->findByLabelsAndUser(explode(',', $tagsLabels), $this->getUser()->getId());
if (empty($tags)) { if (empty($tags)) {
throw $this->createNotFoundException('Tags not found'); throw $this->createNotFoundException('Tags not found');
} }
$this->getDoctrine() $this->get('doctrine')
->getRepository(Entry::class) ->getRepository(Entry::class)
->removeTags($this->getUser()->getId(), $tags); ->removeTags($this->getUser()->getId(), $tags);
@ -167,13 +167,13 @@ class TagRestController extends WallabagRestController
{ {
$this->validateAuthentication(); $this->validateAuthentication();
$tagFromDb = $this->getDoctrine()->getRepository(Tag::class)->findByLabelsAndUser([$tag->getLabel()], $this->getUser()->getId()); $tagFromDb = $this->get('doctrine')->getRepository(Tag::class)->findByLabelsAndUser([$tag->getLabel()], $this->getUser()->getId());
if (empty($tagFromDb)) { if (empty($tagFromDb)) {
throw $this->createNotFoundException('Tag not found'); throw $this->createNotFoundException('Tag not found');
} }
$this->getDoctrine() $this->get('doctrine')
->getRepository(Entry::class) ->getRepository(Entry::class)
->removeTag($this->getUser()->getId(), $tag); ->removeTag($this->getUser()->getId(), $tag);
@ -195,7 +195,7 @@ class TagRestController extends WallabagRestController
$tags = [$tags]; $tags = [$tags];
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
foreach ($tags as $tag) { foreach ($tags as $tag) {
if (0 === \count($tag->getEntries())) { if (0 === \count($tag->getEntries())) {

View file

@ -102,6 +102,7 @@ class UserRestController extends WallabagRestController
$userManager = $this->get(UserManagerInterface::class); $userManager = $this->get(UserManagerInterface::class);
$user = $userManager->createUser(); $user = $userManager->createUser();
\assert($user instanceof User);
// user will be disabled BY DEFAULT to avoid spamming account to be enabled // user will be disabled BY DEFAULT to avoid spamming account to be enabled
$user->setEnabled(false); $user->setEnabled(false);
@ -150,7 +151,7 @@ class UserRestController extends WallabagRestController
$client = new Client($user); $client = new Client($user);
$client->setName($request->request->get('client_name', 'Default client')); $client->setName($request->request->get('client_name', 'Default client'));
$this->getDoctrine()->getManager()->persist($client); $this->get('doctrine')->getManager()->persist($client);
$user->addClient($client); $user->addClient($client);

View file

@ -12,6 +12,7 @@ use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface; use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;
use Symfony\Component\Security\Core\Exception\AccessDeniedException; use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Wallabag\UserBundle\Entity\User;
class WallabagRestController extends AbstractFOSRestController class WallabagRestController extends AbstractFOSRestController
{ {
@ -84,6 +85,7 @@ class WallabagRestController extends AbstractFOSRestController
protected function validateUserAccess($requestUserId) protected function validateUserAccess($requestUserId)
{ {
$user = $this->get(TokenStorageInterface::class)->getToken()->getUser(); $user = $this->get(TokenStorageInterface::class)->getToken()->getUser();
\assert($user instanceof User);
if ($requestUserId !== $user->getId()) { if ($requestUserId !== $user->getId()) {
throw $this->createAccessDeniedException('Access forbidden. Entry user id: ' . $requestUserId . ', logged user id: ' . $user->getId()); throw $this->createAccessDeniedException('Access forbidden. Entry user id: ' . $requestUserId . ', logged user id: ' . $user->getId());
} }

View file

@ -4,6 +4,8 @@ namespace Wallabag\ApiBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken; use FOS\OAuthServerBundle\Entity\AccessToken as BaseAccessToken;
use FOS\OAuthServerBundle\Model\ClientInterface;
use FOS\UserBundle\Model\UserInterface;
/** /**
* @ORM\Table("oauth2_access_tokens") * @ORM\Table("oauth2_access_tokens")
@ -37,12 +39,16 @@ class AccessToken extends BaseAccessToken
/** /**
* @ORM\ManyToOne(targetEntity="Client", inversedBy="accessTokens") * @ORM\ManyToOne(targetEntity="Client", inversedBy="accessTokens")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*
* @var ClientInterface
*/ */
protected $client; protected $client;
/** /**
* @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
*
* @var UserInterface
*/ */
protected $user; protected $user;
} }

View file

@ -4,6 +4,8 @@ namespace Wallabag\ApiBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode; use FOS\OAuthServerBundle\Entity\AuthCode as BaseAuthCode;
use FOS\OAuthServerBundle\Model\ClientInterface;
use FOS\UserBundle\Model\UserInterface;
/** /**
* @ORM\Table("oauth2_auth_codes") * @ORM\Table("oauth2_auth_codes")
@ -37,12 +39,16 @@ class AuthCode extends BaseAuthCode
/** /**
* @ORM\ManyToOne(targetEntity="Client") * @ORM\ManyToOne(targetEntity="Client")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*
* @var ClientInterface
*/ */
protected $client; protected $client;
/** /**
* @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
*
* @var UserInterface
*/ */
protected $user; protected $user;
} }

View file

@ -4,6 +4,8 @@ namespace Wallabag\ApiBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken; use FOS\OAuthServerBundle\Entity\RefreshToken as BaseRefreshToken;
use FOS\OAuthServerBundle\Model\ClientInterface;
use FOS\UserBundle\Model\UserInterface;
/** /**
* @ORM\Table("oauth2_refresh_tokens") * @ORM\Table("oauth2_refresh_tokens")
@ -37,12 +39,16 @@ class RefreshToken extends BaseRefreshToken
/** /**
* @ORM\ManyToOne(targetEntity="Client", inversedBy="refreshTokens") * @ORM\ManyToOne(targetEntity="Client", inversedBy="refreshTokens")
* @ORM\JoinColumn(nullable=false) * @ORM\JoinColumn(nullable=false)
*
* @var ClientInterface
*/ */
protected $client; protected $client;
/** /**
* @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User") * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE") * @ORM\JoinColumn(name="user_id", referencedColumnName="id", onDelete="CASCADE")
*
* @var UserInterface
*/ */
protected $user; protected $user;
} }

View file

@ -6,6 +6,9 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Wallabag\ApiBundle\Entity\Client; use Wallabag\ApiBundle\Entity\Client;
/**
* @method Client[] findByUser(int $userId)
*/
class ClientRepository extends ServiceEntityRepository class ClientRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)

View file

@ -43,7 +43,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand
return 1; return 1;
} }
} else { } else {
$users = $this->getDoctrine()->getRepository(User::class)->findAll(); $users = $this->getContainer()->get('doctrine')->getRepository(User::class)->findAll();
$output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users))); $output->writeln(sprintf('Generating hashed urls for "%d" users', \count($users)));
@ -60,7 +60,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand
private function generateHashedUrls(User $user) private function generateHashedUrls(User $user)
{ {
$em = $this->getContainer()->get(EntityManagerInterface::class); $em = $this->getContainer()->get(EntityManagerInterface::class);
$repo = $this->getDoctrine()->getRepository(Entry::class); $repo = $this->getContainer()->get('doctrine')->getRepository(Entry::class);
$entries = $repo->findByEmptyHashedUrlAndUserId($user->getId()); $entries = $repo->findByEmptyHashedUrlAndUserId($user->getId());
@ -89,7 +89,7 @@ class GenerateUrlHashesCommand extends ContainerAwareCommand
*/ */
private function getUser($username) private function getUser($username)
{ {
return $this->getDoctrine()->getRepository(User::class)->findOneByUserName($username); return $this->getContainer()->get('doctrine')->getRepository(User::class)->findOneByUserName($username);
} }
private function getDoctrine() private function getDoctrine()

View file

@ -20,6 +20,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule; use Wallabag\CoreBundle\Entity\IgnoreOriginInstanceRule;
use Wallabag\CoreBundle\Entity\InternalSetting; use Wallabag\CoreBundle\Entity\InternalSetting;
use Wallabag\UserBundle\Entity\User;
class InstallCommand extends ContainerAwareCommand class InstallCommand extends ContainerAwareCommand
{ {
@ -79,6 +80,8 @@ class InstallCommand extends ContainerAwareCommand
$this->io->success('wallabag has been successfully installed.'); $this->io->success('wallabag has been successfully installed.');
$this->io->success('You can now configure your web server, see https://doc.wallabag.org'); $this->io->success('You can now configure your web server, see https://doc.wallabag.org');
return 0;
} }
private function checkRequirements() private function checkRequirements()
@ -261,6 +264,7 @@ class InstallCommand extends ContainerAwareCommand
$userManager = $this->getContainer()->get(UserManagerInterface::class); $userManager = $this->getContainer()->get(UserManagerInterface::class);
$user = $userManager->createUser(); $user = $userManager->createUser();
\assert($user instanceof User);
$user->setUsername($this->io->ask('Username', 'wallabag')); $user->setUsername($this->io->ask('Username', 'wallabag'));

View file

@ -47,7 +47,7 @@ class TagAllCommand extends ContainerAwareCommand
$io->text('Persist ' . \count($entries) . ' entries... '); $io->text('Persist ' . \count($entries) . ' entries... ');
$em = $this->getDoctrine()->getManager(); $em = $this->getContainer()->get('doctrine')->getManager();
foreach ($entries as $entry) { foreach ($entries as $entry) {
$em->persist($entry); $em->persist($entry);
} }

View file

@ -44,7 +44,7 @@ class ConfigController extends Controller
*/ */
public function indexAction(Request $request) public function indexAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$config = $this->getConfig(); $config = $this->getConfig();
$userManager = $this->container->get(UserManagerInterface::class); $userManager = $this->container->get(UserManagerInterface::class);
$user = $this->getUser(); $user = $this->getUser();
@ -125,7 +125,7 @@ class ConfigController extends Controller
$action = $this->generateUrl('config') . '#set5'; $action = $this->generateUrl('config') . '#set5';
if ($request->query->has('tagging-rule')) { if ($request->query->has('tagging-rule')) {
$taggingRule = $this->getDoctrine() $taggingRule = $this->get('doctrine')
->getRepository(TaggingRule::class) ->getRepository(TaggingRule::class)
->find($request->query->get('tagging-rule')); ->find($request->query->get('tagging-rule'));
@ -188,7 +188,7 @@ class ConfigController extends Controller
$action = $this->generateUrl('config') . '#set6'; $action = $this->generateUrl('config') . '#set6';
if ($request->query->has('ignore-origin-user-rule')) { if ($request->query->has('ignore-origin-user-rule')) {
$ignoreOriginUserRule = $this->getDoctrine() $ignoreOriginUserRule = $this->get('doctrine')
->getRepository(IgnoreOriginUserRule::class) ->getRepository(IgnoreOriginUserRule::class)
->find($request->query->get('ignore-origin-user-rule')); ->find($request->query->get('ignore-origin-user-rule'));
@ -414,7 +414,7 @@ class ConfigController extends Controller
$config = $this->getConfig(); $config = $this->getConfig();
$config->setFeedToken(Utils::generateToken()); $config->setFeedToken(Utils::generateToken());
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($config); $em->persist($config);
$em->flush(); $em->flush();
@ -440,7 +440,7 @@ class ConfigController extends Controller
$config = $this->getConfig(); $config = $this->getConfig();
$config->setFeedToken(null); $config->setFeedToken(null);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($config); $em->persist($config);
$em->flush(); $em->flush();
@ -467,7 +467,7 @@ class ConfigController extends Controller
{ {
$this->validateRuleAction($rule); $this->validateRuleAction($rule);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($rule); $em->remove($rule);
$em->flush(); $em->flush();
@ -504,7 +504,7 @@ class ConfigController extends Controller
{ {
$this->validateRuleAction($rule); $this->validateRuleAction($rule);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($rule); $em->remove($rule);
$em->flush(); $em->flush();
@ -541,7 +541,7 @@ class ConfigController extends Controller
{ {
switch ($type) { switch ($type) {
case 'annotations': case 'annotations':
$this->getDoctrine() $this->get('doctrine')
->getRepository(Annotation::class) ->getRepository(Annotation::class)
->removeAllByUserId($this->getUser()->getId()); ->removeAllByUserId($this->getUser()->getId());
break; break;
@ -552,7 +552,7 @@ class ConfigController extends Controller
// SQLite doesn't care about cascading remove, so we need to manually remove associated stuff // SQLite doesn't care about cascading remove, so we need to manually remove associated stuff
// otherwise they won't be removed ... // otherwise they won't be removed ...
if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) { if ($this->get(ManagerRegistry::class)->getConnection()->getDatabasePlatform() instanceof SqlitePlatform) {
$this->getDoctrine()->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId()); $this->get('doctrine')->getRepository(Annotation::class)->removeAllByUserId($this->getUser()->getId());
} }
// manually remove tags to avoid orphan tag // manually remove tags to avoid orphan tag
@ -622,7 +622,7 @@ class ConfigController extends Controller
$user = $this->getUser(); $user = $this->getUser();
$user->getConfig()->setListMode(!$user->getConfig()->getListMode()); $user->getConfig()->setListMode(!$user->getConfig()->getListMode());
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($user); $em->persist($user);
$em->flush(); $em->flush();
@ -691,7 +691,7 @@ class ConfigController extends Controller
->removeTags($userId, $tags); ->removeTags($userId, $tags);
// cleanup orphan tags // cleanup orphan tags
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
foreach ($tags as $tag) { foreach ($tags as $tag) {
if (0 === \count($tag->getEntries())) { if (0 === \count($tag->getEntries())) {
@ -726,9 +726,9 @@ class ConfigController extends Controller
private function removeAnnotationsForArchivedByUserId($userId) private function removeAnnotationsForArchivedByUserId($userId)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$archivedEntriesAnnotations = $this->getDoctrine() $archivedEntriesAnnotations = $this->get('doctrine')
->getRepository(Annotation::class) ->getRepository(Annotation::class)
->findAllArchivedEntriesByUser($userId); ->findAllArchivedEntriesByUser($userId);
@ -757,7 +757,7 @@ class ConfigController extends Controller
*/ */
private function getConfig() private function getConfig()
{ {
$config = $this->getDoctrine() $config = $this->get('doctrine')
->getRepository(ConfigEntity::class) ->getRepository(ConfigEntity::class)
->findOneByUser($this->getUser()); ->findOneByUser($this->getUser());

View file

@ -40,7 +40,7 @@ class EntryController extends Controller
*/ */
public function massAction(Request $request) public function massAction(Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$values = $request->request->all(); $values = $request->request->all();
$tagsToAdd = []; $tagsToAdd = [];
@ -173,7 +173,7 @@ class EntryController extends Controller
$this->updateEntry($entry); $this->updateEntry($entry);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -201,7 +201,7 @@ class EntryController extends Controller
if (false === $this->checkIfEntryAlreadyExists($entry)) { if (false === $this->checkIfEntryAlreadyExists($entry)) {
$this->updateEntry($entry); $this->updateEntry($entry);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -238,7 +238,7 @@ class EntryController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -409,7 +409,7 @@ class EntryController extends Controller
return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()])); return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
} }
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -431,7 +431,7 @@ class EntryController extends Controller
$this->checkUserAction($entry); $this->checkUserAction($entry);
$entry->toggleArchive(); $entry->toggleArchive();
$this->getDoctrine()->getManager()->flush(); $this->get('doctrine')->getManager()->flush();
$message = 'flashes.entry.notice.entry_unarchived'; $message = 'flashes.entry.notice.entry_unarchived';
if ($entry->isArchived()) { if ($entry->isArchived()) {
@ -461,7 +461,7 @@ class EntryController extends Controller
$entry->toggleStar(); $entry->toggleStar();
$entry->updateStar($entry->isStarred()); $entry->updateStar($entry->isStarred());
$this->getDoctrine()->getManager()->flush(); $this->get('doctrine')->getManager()->flush();
$message = 'flashes.entry.notice.entry_unstarred'; $message = 'flashes.entry.notice.entry_unstarred';
if ($entry->isStarred()) { if ($entry->isStarred()) {
@ -500,7 +500,7 @@ class EntryController extends Controller
// entry deleted, dispatch event about it! // entry deleted, dispatch event about it!
$this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry)); $this->get(EventDispatcherInterface::class)->dispatch(EntryDeletedEvent::NAME, new EntryDeletedEvent($entry));
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($entry); $em->remove($entry);
$em->flush(); $em->flush();
@ -532,7 +532,7 @@ class EntryController extends Controller
if (null === $entry->getUid()) { if (null === $entry->getUid()) {
$entry->generateUid(); $entry->generateUid();
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
} }
@ -555,7 +555,7 @@ class EntryController extends Controller
$entry->cleanUid(); $entry->cleanUid();
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();

View file

@ -50,7 +50,7 @@ class IgnoreOriginInstanceRuleController extends Controller
$form->handleRequest($request); $form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) { if ($form->isSubmitted() && $form->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($ignoreOriginInstanceRule); $em->persist($ignoreOriginInstanceRule);
$em->flush(); $em->flush();
@ -82,7 +82,7 @@ class IgnoreOriginInstanceRuleController extends Controller
$editForm->handleRequest($request); $editForm->handleRequest($request);
if ($editForm->isSubmitted() && $editForm->isValid()) { if ($editForm->isSubmitted() && $editForm->isValid()) {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($ignoreOriginInstanceRule); $em->persist($ignoreOriginInstanceRule);
$em->flush(); $em->flush();
@ -119,7 +119,7 @@ class IgnoreOriginInstanceRuleController extends Controller
$this->get(TranslatorInterface::class)->trans('flashes.ignore_origin_instance_rule.notice.deleted') $this->get(TranslatorInterface::class)->trans('flashes.ignore_origin_instance_rule.notice.deleted')
); );
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($ignoreOriginInstanceRule); $em->remove($ignoreOriginInstanceRule);
$em->flush(); $em->flush();
} }

View file

@ -60,7 +60,7 @@ class SiteCredentialController extends Controller
$credential->setUsername($this->get(CryptoProxy::class)->crypt($credential->getUsername())); $credential->setUsername($this->get(CryptoProxy::class)->crypt($credential->getUsername()));
$credential->setPassword($this->get(CryptoProxy::class)->crypt($credential->getPassword())); $credential->setPassword($this->get(CryptoProxy::class)->crypt($credential->getPassword()));
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($credential); $em->persist($credential);
$em->flush(); $em->flush();
@ -99,7 +99,7 @@ class SiteCredentialController extends Controller
$siteCredential->setUsername($this->get(CryptoProxy::class)->crypt($siteCredential->getUsername())); $siteCredential->setUsername($this->get(CryptoProxy::class)->crypt($siteCredential->getUsername()));
$siteCredential->setPassword($this->get(CryptoProxy::class)->crypt($siteCredential->getPassword())); $siteCredential->setPassword($this->get(CryptoProxy::class)->crypt($siteCredential->getPassword()));
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($siteCredential); $em->persist($siteCredential);
$em->flush(); $em->flush();
@ -140,7 +140,7 @@ class SiteCredentialController extends Controller
$this->get(TranslatorInterface::class)->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()]) $this->get(TranslatorInterface::class)->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()])
); );
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($siteCredential); $em->remove($siteCredential);
$em->flush(); $em->flush();
} }

View file

@ -39,7 +39,7 @@ class TagController extends Controller
$form->get('label')->getData() $form->get('label')->getData()
); );
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->persist($entry); $em->persist($entry);
$em->flush(); $em->flush();
@ -67,7 +67,7 @@ class TagController extends Controller
public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag) public function removeTagFromEntry(Request $request, Entry $entry, Tag $tag)
{ {
$entry->removeTag($tag); $entry->removeTag($tag);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->flush(); $em->flush();
// remove orphan tag in case no entries are associated to it // remove orphan tag in case no entries are associated to it
@ -188,7 +188,7 @@ class TagController extends Controller
$entry->removeTag($tag); $entry->removeTag($tag);
} }
$this->getDoctrine()->getManager()->flush(); $this->get('doctrine')->getManager()->flush();
$this->get(SessionInterface::class)->getFlashBag()->add( $this->get(SessionInterface::class)->getFlashBag()->add(
'notice', 'notice',
@ -212,7 +212,7 @@ class TagController extends Controller
/** @var QueryBuilder $qb */ /** @var QueryBuilder $qb */
$qb = $this->get(EntryRepository::class)->getBuilderForSearchByUser($this->getUser()->getId(), $filter, $currentRoute); $qb = $this->get(EntryRepository::class)->getBuilderForSearchByUser($this->getUser()->getId(), $filter, $currentRoute);
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$entries = $qb->getQuery()->getResult(); $entries = $qb->getQuery()->getResult();
@ -246,7 +246,7 @@ class TagController extends Controller
// remove orphan tag in case no entries are associated to it // remove orphan tag in case no entries are associated to it
if (0 === \count($tag->getEntries())) { if (0 === \count($tag->getEntries())) {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($tag); $em->remove($tag);
$em->flush(); $em->flush();
} }

View file

@ -4,6 +4,7 @@ namespace Wallabag\CoreBundle\Event\Listener;
use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent;
use Wallabag\UserBundle\Entity\User;
/** /**
* Stores the locale of the user in the session after the login. * Stores the locale of the user in the session after the login.
@ -25,6 +26,7 @@ class UserLocaleListener
public function onInteractiveLogin(InteractiveLoginEvent $event) public function onInteractiveLogin(InteractiveLoginEvent $event)
{ {
$user = $event->getAuthenticationToken()->getUser(); $user = $event->getAuthenticationToken()->getUser();
\assert($user instanceof User);
if (null !== $user->getConfig()->getLanguage() && null === $this->session->get('_locale')) { if (null !== $user->getConfig()->getLanguage() && null === $this->session->get('_locale')) {
$this->session->set('_locale', $user->getConfig()->getLanguage()); $this->session->set('_locale', $user->getConfig()->getLanguage());

View file

@ -15,11 +15,12 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\CoreBundle\Repository\EntryRepository; use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\UserBundle\Entity\User;
class EntryFilterType extends AbstractType class EntryFilterType extends AbstractType
{ {
private $user;
private $repository; private $repository;
private $tokenStorage;
/** /**
* Repository & user are used to get a list of language entries for this user. * Repository & user are used to get a list of language entries for this user.
@ -27,16 +28,15 @@ class EntryFilterType extends AbstractType
public function __construct(EntryRepository $entryRepository, TokenStorageInterface $tokenStorage) public function __construct(EntryRepository $entryRepository, TokenStorageInterface $tokenStorage)
{ {
$this->repository = $entryRepository; $this->repository = $entryRepository;
$this->tokenStorage = $tokenStorage;
$this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
if (null === $this->user || !\is_object($this->user)) {
return;
}
} }
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
\assert($user instanceof User);
$builder $builder
->add('readingTime', NumberRangeFilterType::class, [ ->add('readingTime', NumberRangeFilterType::class, [
'left_number_options' => [ 'left_number_options' => [
@ -47,17 +47,19 @@ class EntryFilterType extends AbstractType
'condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL, 'condition_operator' => FilterOperands::OPERATOR_LOWER_THAN_EQUAL,
'attr' => ['min' => 0], 'attr' => ['min' => 0],
], ],
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) use ($user) {
$lower = $values['value']['left_number'][0]; $lower = $values['value']['left_number'][0];
$upper = $values['value']['right_number'][0]; $upper = $values['value']['right_number'][0];
$min = (int) ($lower * $this->user->getConfig()->getReadingSpeed() / 200);
$max = (int) ($upper * $this->user->getConfig()->getReadingSpeed() / 200);
if (null === $lower && null === $upper) { if (null === $lower && null === $upper) {
// no value? no filter // no value? no filter
return; return;
} elseif (null === $lower && null !== $upper) { }
$min = (int) ($lower * $user->getConfig()->getReadingSpeed() / 200);
$max = (int) ($upper * $user->getConfig()->getReadingSpeed() / 200);
if (null === $lower && null !== $upper) {
// only lower value is defined: query all entries with reading LOWER THAN this value // only lower value is defined: query all entries with reading LOWER THAN this value
$expression = $filterQuery->getExpr()->lte($field, $max); $expression = $filterQuery->getExpr()->lte($field, $max);
} elseif (null !== $lower && null === $upper) { } elseif (null !== $lower && null === $upper) {
@ -176,7 +178,7 @@ class EntryFilterType extends AbstractType
'label' => 'entry.filters.is_public_label', 'label' => 'entry.filters.is_public_label',
]) ])
->add('language', ChoiceFilterType::class, [ ->add('language', ChoiceFilterType::class, [
'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), 'choices' => array_flip($this->repository->findDistinctLanguageByUser($user->getId())),
'label' => 'entry.filters.language_label', 'label' => 'entry.filters.language_label',
]) ])
; ;

View file

@ -21,11 +21,11 @@ class EntriesExport
private $wallabagUrl; private $wallabagUrl;
private $logoPath; private $logoPath;
private $translator; private $translator;
private $tokenStorage;
private $title = ''; private $title = '';
private $entries = []; private $entries = [];
private $author = 'wallabag'; private $author = 'wallabag';
private $language = ''; private $language = '';
private $user;
/** /**
* @param TranslatorInterface $translator Translator service * @param TranslatorInterface $translator Translator service
@ -38,13 +38,7 @@ class EntriesExport
$this->translator = $translator; $this->translator = $translator;
$this->wallabagUrl = $wallabagUrl; $this->wallabagUrl = $wallabagUrl;
$this->logoPath = $logoPath; $this->logoPath = $logoPath;
$this->tokenStorage = $tokenStorage;
/* @var User $user */
$this->user = $tokenStorage->getToken() ? $tokenStorage->getToken()->getUser() : null;
if (null === $this->user || !\is_object($this->user)) {
return;
}
} }
/** /**
@ -140,6 +134,9 @@ class EntriesExport
*/ */
private function produceEpub() private function produceEpub()
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
\assert($user instanceof User);
/* /*
* Start and End of the book * Start and End of the book
*/ */
@ -213,7 +210,7 @@ class EntriesExport
$publishedDate = $entry->getPublishedAt()->format('Y-m-d'); $publishedDate = $entry->getPublishedAt()->format('Y-m-d');
} }
$readingTime = $entry->getReadingTime() / $this->user->getConfig()->getReadingSpeed() * 200; $readingTime = $entry->getReadingTime() / $user->getConfig()->getReadingSpeed() * 200;
$titlepage = $content_start . $titlepage = $content_start .
'<h1>' . $entry->getTitle() . '</h1>' . '<h1>' . $entry->getTitle() . '</h1>' .
@ -306,6 +303,9 @@ class EntriesExport
*/ */
private function producePdf() private function producePdf()
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
\assert($user instanceof User);
$pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false); $pdf = new \TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
/* /*
@ -331,7 +331,7 @@ class EntriesExport
$authors = implode(',', $publishedBy); $authors = implode(',', $publishedBy);
} }
$readingTime = $entry->getReadingTime() / $this->user->getConfig()->getReadingSpeed() * 200; $readingTime = $entry->getReadingTime() / $user->getConfig()->getReadingSpeed() * 200;
$pdf->addPage(); $pdf->addPage();
$html = '<h1>' . $entry->getTitle() . '</h1>' . $html = '<h1>' . $entry->getTitle() . '</h1>' .

View file

@ -15,7 +15,7 @@ use Psr\Log\LoggerInterface;
*/ */
class HttpClientFactory implements ClientFactory class HttpClientFactory implements ClientFactory
{ {
/** @var [\GuzzleHttp\Event\SubscriberInterface] */ /** @var SubscriberInterface[] */
private $subscribers = []; private $subscribers = [];
/** @var CookieJar */ /** @var CookieJar */

View file

@ -27,7 +27,7 @@ class PreparePagerForEntries
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
} }
if (null === $user || !\is_object($user)) { if (!$user instanceof User) {
return; return;
} }

View file

@ -5,6 +5,7 @@ namespace Wallabag\CoreBundle\Helper;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\Config;
use Wallabag\UserBundle\Entity\User;
/** /**
* Manage redirections to avoid redirecting to empty routes. * Manage redirections to avoid redirecting to empty routes.
@ -31,7 +32,7 @@ class Redirect
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
if (null === $user || !\is_object($user)) { if (!$user instanceof User) {
return $url; return $url;
} }

View file

@ -8,6 +8,7 @@ use Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInte
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Repository\UserRepository;
/** /**
* ParamConverter used in the Feed controller to retrieve the right user according to * ParamConverter used in the Feed controller to retrieve the right user according to
@ -76,6 +77,7 @@ class UsernameFeedTokenConverter implements ParamConverterInterface
// Get actual entity manager for class // Get actual entity manager for class
$em = $this->registry->getManagerForClass($configuration->getClass()); $em = $this->registry->getManagerForClass($configuration->getClass());
/** @var UserRepository $userRepository */
$userRepository = $em->getRepository($configuration->getClass()); $userRepository = $em->getRepository($configuration->getClass());
// Try to find user by its username and config feed_token // Try to find user by its username and config feed_token

View file

@ -6,6 +6,9 @@ use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Wallabag\CoreBundle\Entity\Config; use Wallabag\CoreBundle\Entity\Config;
/**
* @method Config|null findOneByUser(int $userId)
*/
class ConfigRepository extends ServiceEntityRepository class ConfigRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)

View file

@ -12,6 +12,10 @@ use Wallabag\CoreBundle\Entity\Entry;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
use Wallabag\CoreBundle\Helper\UrlHasher; use Wallabag\CoreBundle\Helper\UrlHasher;
/**
* @method Entry[] findById(int $id)
* @method Entry|null findOneByUser(int $userId)
*/
class EntryRepository extends ServiceEntityRepository class EntryRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)

View file

@ -9,6 +9,8 @@ use Wallabag\CoreBundle\Helper\CryptoProxy;
/** /**
* SiteCredentialRepository. * SiteCredentialRepository.
*
* @method SiteCredential[] findByUser(int $userId)
*/ */
class SiteCredentialRepository extends ServiceEntityRepository class SiteCredentialRepository extends ServiceEntityRepository
{ {

View file

@ -7,6 +7,10 @@ use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Wallabag\CoreBundle\Entity\Tag; use Wallabag\CoreBundle\Entity\Tag;
/**
* @method Tag|null findOneByLabel(string $label)
* @method Tag|null findOneBySlug(string $slug)
*/
class TagRepository extends ServiceEntityRepository class TagRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)

View file

@ -10,6 +10,7 @@ use Twig\TwigFilter;
use Twig\TwigFunction; use Twig\TwigFunction;
use Wallabag\CoreBundle\Repository\EntryRepository; use Wallabag\CoreBundle\Repository\EntryRepository;
use Wallabag\CoreBundle\Repository\TagRepository; use Wallabag\CoreBundle\Repository\TagRepository;
use Wallabag\UserBundle\Entity\User;
class WallabagExtension extends AbstractExtension implements GlobalsInterface class WallabagExtension extends AbstractExtension implements GlobalsInterface
{ {
@ -81,7 +82,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
if (null === $user || !\is_object($user)) { if (!$user instanceof User) {
return 0; return 0;
} }
@ -127,7 +128,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
if (null === $user || !\is_object($user)) { if (!$user instanceof User) {
return 0; return 0;
} }
@ -143,7 +144,7 @@ class WallabagExtension extends AbstractExtension implements GlobalsInterface
{ {
$user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null; $user = $this->tokenStorage->getToken() ? $this->tokenStorage->getToken()->getUser() : null;
if (null === $user || !\is_object($user)) { if (!$user instanceof User) {
return 0; return 0;
} }

View file

@ -112,5 +112,7 @@ class ImportCommand extends ContainerAwareCommand
$em->clear(); $em->clear();
$output->writeln('End : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---'); $output->writeln('End : ' . (new \DateTime())->format('d-m-Y G:i:s') . ' ---');
return 0;
} }
} }

View file

@ -40,5 +40,7 @@ class RedisWorkerCommand extends ContainerAwareCommand
); );
$worker->start(); $worker->start();
return 0;
} }
} }

View file

@ -37,6 +37,7 @@ class ManageController extends Controller
$userManager = $this->container->get(UserManagerInterface::class); $userManager = $this->container->get(UserManagerInterface::class);
$user = $userManager->createUser(); $user = $userManager->createUser();
\assert($user instanceof User);
// enable created user by default // enable created user by default
$user->setEnabled(true); $user->setEnabled(true);
@ -127,7 +128,7 @@ class ManageController extends Controller
$this->get(TranslatorInterface::class)->trans('flashes.user.notice.deleted', ['%username%' => $user->getUsername()]) $this->get(TranslatorInterface::class)->trans('flashes.user.notice.deleted', ['%username%' => $user->getUsername()])
); );
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$em->remove($user); $em->remove($user);
$em->flush(); $em->flush();
} }
@ -147,7 +148,7 @@ class ManageController extends Controller
*/ */
public function searchFormAction(Request $request, $page = 1) public function searchFormAction(Request $request, $page = 1)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->get('doctrine')->getManager();
$qb = $em->getRepository(User::class)->createQueryBuilder('u'); $qb = $em->getRepository(User::class)->createQueryBuilder('u');
$form = $this->createForm(SearchUserType::class); $form = $this->createForm(SearchUserType::class);

View file

@ -7,6 +7,9 @@ use Doctrine\ORM\QueryBuilder;
use Doctrine\Persistence\ManagerRegistry; use Doctrine\Persistence\ManagerRegistry;
use Wallabag\UserBundle\Entity\User; use Wallabag\UserBundle\Entity\User;
/**
* @method User|null findOneById(int $id)
*/
class UserRepository extends ServiceEntityRepository class UserRepository extends ServiceEntityRepository
{ {
public function __construct(ManagerRegistry $registry) public function __construct(ManagerRegistry $registry)

View file

@ -3,6 +3,8 @@
namespace Tests\Wallabag\AnnotationBundle; namespace Tests\Wallabag\AnnotationBundle;
use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Model\UserManager;
use FOS\UserBundle\Security\LoginManager;
use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie; use Symfony\Component\BrowserKit\Cookie;
@ -47,9 +49,9 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
$client = static::createClient(); $client = static::createClient();
$container = $client->getContainer(); $container = $client->getContainer();
/** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ /** @var UserManager $userManager */
$userManager = $container->get('fos_user.user_manager.test'); $userManager = $container->get('fos_user.user_manager.test');
/** @var $loginManager \FOS\UserBundle\Security\LoginManager */ /** @var LoginManager $loginManager */
$loginManager = $container->get('fos_user.security.login_manager.test'); $loginManager = $container->get('fos_user.security.login_manager.test');
$firewallName = $container->getParameter('fos_user.firewall_name'); $firewallName = $container->getParameter('fos_user.firewall_name');

View file

@ -4,6 +4,8 @@ namespace Tests\Wallabag\ApiBundle;
use Doctrine\ORM\EntityManagerInterface; use Doctrine\ORM\EntityManagerInterface;
use FOS\UserBundle\Model\UserInterface; use FOS\UserBundle\Model\UserInterface;
use FOS\UserBundle\Model\UserManager;
use FOS\UserBundle\Security\LoginManager;
use Symfony\Bundle\FrameworkBundle\Client; use Symfony\Bundle\FrameworkBundle\Client;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie; use Symfony\Component\BrowserKit\Cookie;
@ -37,9 +39,9 @@ abstract class WallabagApiTestCase extends WebTestCase
$client = static::createClient(); $client = static::createClient();
$container = $client->getContainer(); $container = $client->getContainer();
/** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ /** @var UserManager $userManager */
$userManager = $container->get('fos_user.user_manager.test'); $userManager = $container->get('fos_user.user_manager.test');
/** @var $loginManager \FOS\UserBundle\Security\LoginManager */ /** @var LoginManager $loginManager */
$loginManager = $container->get('fos_user.security.login_manager.test'); $loginManager = $container->get('fos_user.security.login_manager.test');
$firewallName = $container->getParameter('fos_user.firewall_name'); $firewallName = $container->getParameter('fos_user.firewall_name');

View file

@ -895,6 +895,8 @@ class ConfigControllerTest extends WallabagCoreTestCase
$user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser(); $user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
\assert($user instanceof User);
$tag = new Tag(); $tag = new Tag();
$tag->setLabel('super'); $tag->setLabel('super');
$em->persist($tag); $em->persist($tag);
@ -980,6 +982,8 @@ class ConfigControllerTest extends WallabagCoreTestCase
$user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser(); $user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
\assert($user instanceof User);
$tag = new Tag(); $tag = new Tag();
$tag->setLabel('super'); $tag->setLabel('super');
$em->persist($tag); $em->persist($tag);
@ -1056,6 +1060,8 @@ class ConfigControllerTest extends WallabagCoreTestCase
$user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser(); $user = static::$kernel->getContainer()->get(TokenStorageInterface::class)->getToken()->getUser();
\assert($user instanceof User);
$tag = new Tag(); $tag = new Tag();
$tag->setLabel('super'); $tag->setLabel('super');
$em->persist($tag); $em->persist($tag);

View file

@ -18,6 +18,9 @@ class RedirectTest extends TestCase
/** @var Redirect */ /** @var Redirect */
private $redirect; private $redirect;
/** @var User */
private $user;
/** @var UsernamePasswordToken */ /** @var UsernamePasswordToken */
private $token; private $token;
@ -32,24 +35,24 @@ class RedirectTest extends TestCase
->with('homepage') ->with('homepage')
->willReturn('homepage'); ->willReturn('homepage');
$user = new User(); $this->user = new User();
$user->setName('youpi'); $this->user->setName('youpi');
$user->setEmail('youpi@youpi.org'); $this->user->setEmail('youpi@youpi.org');
$user->setUsername('youpi'); $this->user->setUsername('youpi');
$user->setPlainPassword('youpi'); $this->user->setPlainPassword('youpi');
$user->setEnabled(true); $this->user->setEnabled(true);
$user->addRole('ROLE_SUPER_ADMIN'); $this->user->addRole('ROLE_SUPER_ADMIN');
$config = new Config($user); $config = new Config($this->user);
$config->setItemsPerPage(30); $config->setItemsPerPage(30);
$config->setReadingSpeed(200); $config->setReadingSpeed(200);
$config->setLanguage('en'); $config->setLanguage('en');
$config->setPocketConsumerKey('xxxxx'); $config->setPocketConsumerKey('xxxxx');
$config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE); $config->setActionMarkAsRead(Config::REDIRECT_TO_CURRENT_PAGE);
$user->setConfig($config); $this->user->setConfig($config);
$this->token = new UsernamePasswordToken($user, 'password', 'key'); $this->token = new UsernamePasswordToken($this->user, 'password', 'key');
$tokenStorage = new TokenStorage(); $tokenStorage = new TokenStorage();
$tokenStorage->setToken($this->token); $tokenStorage->setToken($this->token);
@ -87,7 +90,7 @@ class RedirectTest extends TestCase
public function testUserForRedirectToHomepage() public function testUserForRedirectToHomepage()
{ {
$this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); $this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
$redirectUrl = $this->redirect->to('/unread/list'); $redirectUrl = $this->redirect->to('/unread/list');
@ -96,7 +99,7 @@ class RedirectTest extends TestCase
public function testUserForRedirectWithIgnoreActionMarkAsRead() public function testUserForRedirectWithIgnoreActionMarkAsRead()
{ {
$this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); $this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
$redirectUrl = $this->redirect->to('/unread/list', '', true); $redirectUrl = $this->redirect->to('/unread/list', '', true);
@ -105,7 +108,7 @@ class RedirectTest extends TestCase
public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead() public function testUserForRedirectNullWithFallbackWithIgnoreActionMarkAsRead()
{ {
$this->token->getUser()->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE); $this->user->getConfig()->setActionMarkAsRead(Config::REDIRECT_TO_HOMEPAGE);
$redirectUrl = $this->redirect->to(null, 'fallback', true); $redirectUrl = $this->redirect->to(null, 'fallback', true);