-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use setFactory service definition method for symfony >= 2.6 (when possible) #566
Conversation
can you expand the .travis.yml file to include more versions of Symfony, if possible even including Symfony 3 https://github.com/doctrine/DoctrinePHPCRBundle/pull/187/files |
@lsmith77 I expanded symfony version up to 3.0.* in .travis.yml but not for 2.7 and up tests are failing on some other tests related to CacheResolver. I could probably fix them but i think it shouldn't be subject of this PR. Any suggestion? |
Any updates on this? Deprecation messages are quite annoying :( |
@gremo You can use my fork until this one is resolved or generally disable deprecation messages with custom console file https://gist.github.com/adam187/9bdc986bcc69f4090f30 |
@adam187 thanks, I will use your fork until gets merged. You should (I could be wrong) tag your current master version as 1.2.4 so that when this get merged we can simply remove the repository in composer.json and get the fixed version from the original repo (my minimum stability is stable):
Right now to use your fork I'm forced to use:
|
@gremo You have to use
because this changes hasn't been merged to master on my fork. |
to fix the memory issue with PHP 5.3 add the following to the travis build section: for the deprecation notices you can add the symfony phpunit bridge: |
48d00e4
to
0e3e544
Compare
@lsmith77 I added memory limit rule and phpunit-bridge but there are still some errors duo OptionsResolver/OptionsResolverInterface for symfony 2.7 and above. Should i fix them here or is it a case for another PR ? |
no I think its good if we do it all in here. thank you for your work! |
$awsS3ClientDefinition = new Definition('Aws\S3\S3Client'); | ||
$awsS3ClientDefinition->setFactoryClass('Aws\S3\S3Client'); | ||
$awsS3ClientDefinition->setFactoryMethod('factory'); | ||
if (method_exists($awsS3ClientDefinition, 'setFactory')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, it is better to check symfony version here to be more explicit why we have this if
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And it will also reflect the preferred may and the one which will be removed in future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makasim I was referring how it was resolved in other bundles like https://github.com/doctrine/DoctrineBundle/blob/master/DependencyInjection/DoctrineExtension.php#L136 for example
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay, could you add a comment to else
statement that it can be remove when we drop support of symfony <2.7
setFactoryClass, setFactoryMethod is deprecated since 2.6
to be more consistent optionResolover
@lsmith77 Ready to check |
/** | ||
* @param ContainerBuilder $container | ||
*/ | ||
private function setFactories($container) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ContainerInterface typehint
@makasim Updated |
'index_key' => 'string', | ||
); | ||
|
||
if (version_compare(Kernel::VERSION_ID, '20600') >= 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the logic behind this change. Looks strange to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@makasim Since symfony 2.6 setAllowedTypes api changed.
Now you call it with option and array of types instead off array where key is option and value is allowed types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but it is a BC break, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but it's deprecated since 2.6 to be removed in 3.0 https://github.com/symfony/symfony/blob/2.8/src/Symfony/Component/OptionsResolver/OptionsResolver.php#L591
@makasim Updated |
use setFactory service definition method for symfony >= 2.6 (when possible)
Thanks for adding 2.7 support but still there is warning while updating composer. Deprecated: Symfony\Component\DependencyInjection\Definition::setFactoryClass(Aws\S3\S3Client) is deprecated since version 2.6 and will be removed in 3.0. Use Definition::setFactory() instead. in vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Definition.php on line 101 |
@adam187 this deprecation was "fixed", wasn't it? @vishalmelmatti Did you upgrade to 1.3.0 version. |
@makasim yeah I upgraded to 1.3.0. This is my composer.lock "name": "liip/imagine-bundle", |
@vishalmelmatti Are you sure this warning is from this bundle and not from some service definition in yml/xml? |
@adam187 Ah, it could be due to this http://symfony.com/doc/master/bundles/LiipImagineBundle/cache-resolver/aws_s3.html#create-resolver-as-a-service . I am defining my custom Aws client service. |
|
@adam187 Great. It clears warnings. Thanks a lot. |
setFactoryClass, setFactoryMethod is deprecated since 2.6