8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Current dev-master don't work with symfony 2.3 #12

Closed Cbruyere closed 9 years ago

Cbruyere commented 9 years ago

Hello, I tried to use dev-master in symfony 2.3 but unfortunately composer update gived me this error : (same error using ~3.0)

[Symfony\Component\DependencyInjection\Exception InvalidArgumentException]
Unable to parse file "/var/www/apmystorage/vendor/eightpoints/guzzle-bundle/EightPoints/Bundle/GuzzleBundle/DependencyInjection/../Resources/config/services.xml".

Is there any known issue ? or anything wrong I did ?

florianpreusner commented 9 years ago

Hi,

this problem seems to be related that expression language is only supported >= 2.4. dev-master/3.x is using expression language in services.xml.

Please try to use version 2.x if you are not able to upgrade to symfony >= 2.4 - for example.

Hope that helps. Going to update README.md to add this requirement.

Best regards Florian

Cbruyere commented 9 years ago

Oh sorry I didn't notice requirements for this bundle, thanks a lot for your answer I will up to SF 2.4 regards.

Cbruyere commented 9 years ago

Well, I had up to symfony 2.4 PHP 5.6 and I have the same problem , sorry to re-open this issue.

EDIT : seems to be good with SF 2.7.

florianpreusner commented 9 years ago

Ok, found the issue. Following error appears when using Symfony 2.4.10:

[InvalidArgumentException]
[ERROR 1871] Element '{http://symfony.com/schema/dic/services}factory': This element is not expected. (in /var/www/guzzletest/ - line 52, column 0)

Factory is used to to push middlewares like logging or header modifications to Guzzle handler:

<service id="guzzle.handler" class="GuzzleHttp\HandlerStack">
    <factory class="GuzzleHttp\HandlerStack" method="create" />
    <call method="push">
        <argument type="expression">service('guzzle_bundle.middleware.request_header').attach()</argument>
    </call>
    <call method="push">
        <argument type="expression">service('guzzle_bundle.middleware.log').log()</argument>
    </call>
</service>

Using factory functionality in dependency injection is only supported by Symfony >= 2.6: http://symfony.com/doc/current/components/dependency_injection/factories.html

I'm sorry. Going to update requirement in README.md.

Cbruyere commented 9 years ago

no problem florian, It was just to tell you it was a problem with requirements :) very good job.