florianv / symfony-swap

:euro: Currency exchange rates for Symfony

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cache not works for Symfony 4.3

chasovskih-grisha opened this issue · comments

In Builder.php line 131:
                                                                                                                                                                                                    
  Argument 1 passed to Swap\Builder::useSimpleCache() must be an instance of Psr\SimpleCache\CacheInterface, instance of Symfony\Component\Cache\Adapter\FilesystemAdapter given, called in /var/w  
  ww/darkbot/api/var/cache/dev/ContainerXkEGgEv/getCurrencyConverterService.php on line 14                                                                                                          
                                                                                                 

In Psr17FactoryDiscovery.php line 22:
                                                                                                                                      
  No PSR-17 request factory found. Install a package from this list: https://packagist.org/providers/psr/http-factory-implementation  
                                                                                                                                      

In DiscoveryFailedException.php line 41:
                                                                                                                                                                                                    
  Could not find resource using any discovery strategy. Find more information at http://docs.php-http.org/en/latest/discovery.html#common-errors                                                    
   - Puli Factory is not available                                                                                                                                                                  
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonClassesStrategy". We tested the following candidates: .                                                                 
   - No valid candidate found using strategy "Http\Discovery\Strategy\CommonPsr17ClassesStrategy". We tested the following candidates: Nyholm\Psr7\Factory\Psr17Factory, Zend\Diactoros\RequestFac  
  tory, Http\Factory\Diactoros\RequestFactory, Http\Factory\Guzzle\RequestFactory, Http\Factory\Slim\RequestFactory.                                                                                
                                                                                                                                                                                                                                                                                                                                                                                                                               

composer require guzzlehttp/psr7 - that's ok, but error still exists after installing

{
    "name": "my-company/api",
    "type": "library",
    "license": "proprietary",
    "description": "api",
    "require": {
        "php": "^7.2.11",
        "ext-json": "*",
        "ext-mysqli": "*",
        "ext-posix": "*",
        "ext-sockets": "*",
        "aws/aws-sdk-php-symfony": "^2.0",
        "blackfire/php-sdk": "^1.19",
        "defuse/php-encryption": "^2.2",
        "doctrine/annotations": "^1.7",
        "doctrine/doctrine-bundle": "^1.11",
        "doctrine/doctrine-migrations-bundle": "^1.3",
        "doctrine/orm": "^2.6",
        "eightpoints/guzzle-bundle": "^7.5",
        "florianv/swap-bundle": "^4.0",
        "friendsofsymfony/rest-bundle": "^2.5",
        "gesdinet/jwt-refresh-token-bundle": "^0.7",
        "guzzlehttp/guzzle": "^6.3",
        "guzzlehttp/psr7": "^1.6",
        "incenteev/composer-parameter-handler": "^2.1",
        "jms/serializer": "^3.2",
        "jms/serializer-bundle": "^3.4",
        "knplabs/knp-paginator-bundle": "^4.0",
        "lexik/jwt-authentication-bundle": "^2.6",
        "longman/telegram-bot": "^0.53.0",
        "maknz/slack": "^1.7",
        "matthiasnoback/symfony-console-form": "^3.6",
        "moneyphp/money": "^3.2",
        "monolog/monolog": "^1.25",
        "nelmio/api-doc-bundle": "^3.4",
        "nelmio/cors-bundle": "^1.5",
        "php-amqplib/rabbitmq-bundle": "^1.14",
        "php-http/curl-client": "~1.7",
        "php-http/discovery": "^1.7",
        "php-http/guzzle6-adapter": "v1.1.1",
        "php-http/httplug": "~1.1",
        "php-http/message": "^1.8",
        "predis/predis": "^1.1",
        "puli/discovery": "^1.0@beta",
        "puli/repository": "^1.0@beta",
        "puli/url-generator": "^1.0@beta",
        "rollbar/rollbar": "^1.8",
        "sensio/framework-extra-bundle": "^3.0",
        "signulls/poloniex-php-sdk": "^1.0.15",
        "snc/redis-bundle": "^2.1",
        "stof/doctrine-extensions-bundle": "^1.3",
        "swagger-api/swagger-ui": "^3.23",
        "symfony/asset": "^4.3",
        "symfony/cache": "^4.3",
        "symfony/console": "^4.3",
        "symfony/event-dispatcher": "^4.3",
        "symfony/flex": "^1.4",
        "symfony/form": "^4.3",
        "symfony/framework-bundle": "^4.3",
        "symfony/http-client": "^4.3",
        "symfony/http-foundation": "^4.3",
        "symfony/monolog-bundle": "^3.4",
        "symfony/orm-pack": "^1.0",
        "symfony/process": "^4.3",
        "symfony/property-access": "^4.3",
        "symfony/property-info": "^4.3",
        "symfony/routing": "^4.3",
        "symfony/security-bundle": "^4.3",
        "symfony/serializer": "^4.3",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/translation": "^4.3",
        "symfony/twig-bundle": "^4.3",
        "symfony/validator": "^4.3",
        "symfony/yaml": "^4.3"
    },
    "require-dev": {
        "behat/behat": "^3.5",
        "behat/mink": "^1.7",
        "behat/mink-browserkit-driver": "^1.3",
        "behat/mink-extension": "^2.3",
        "behat/symfony2-extension": "^2.1",
        "behatch/contexts": "^3.2",
        "codacy/coverage": "^1.4",
        "hautelook/alice-bundle": "^2.5",
        "mockery/mockery": "^1.2",
        "phpmetrics/phpmetrics": "^2.4",
        "roave/security-advisories": "dev-master",
        "sensiolabs/security-checker": "^5.0",
        "symfony/dotenv": "^4.3",
        "symfony/phpunit-bridge": "^4.3",
        "symfony/profiler-pack": "^1.0"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "platform": {
            "php": "7.2.11"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "MyCompany\\": "src/"
        }
    },
    "scripts": {
        "auto-scripts": {
            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
            "security-checker security:check": "script",
            "cache:clear": "symfony-cmd"
        },
        "post-install-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "incenteev-parameters": {
            "file": "config/parameters.yml"
        }
    }
}

commented

Same problem. Would appreciate any help.

@Ulv @chasovskih-grisha composer require nyholm/psr7 does that help ?

Same issue with cache as written [above] (#31 (comment))

Using this receipt tried to add custom PSR-16 compatible cache service with [following] (https://gist.github.com/erop/5a9133a6bb889d90be55be198be958bc)

But now I have Unexpected swap cache type 'psr16_cache_apcu' error. Any ideas how to inject PSR-16 compat cache into Swap\Builder ?

UPDATE: Looks like my psr16_cache_apcu service is just not defined at the time of building Swap

UPDATE 2: Seems like it's fixed in dev-master branch

@erop Thanks for digging into it!

Can you please confirm if the problem is solved and I can close this Issue ?

Oh, sure! It's fixed! Thanks for your project!

Save issue as @erop mentioned on Symfony 5.2.
At the time of building Swap ContainerBuilder has only service_container, florianv_swap.builder and florianv_swap.swap definitions.