07.
Upgrading to Symfony 3!
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
8 Comments
One question: could we do this on easier way? for example:
1) install sf 3 (new folder)
2) copy src (sf 2.7) folder to new symfony 3 (maybe cache and logs files if we want)
3) fix only our code
4) if works fine, move to prod server
On this way we can avoid symfony core and external bundles upgrade issues and focus only on our code (AppBundle).
Is this good idea :) ?
Hey axa,
Actually, I think your idea is partially OK, but it depends, because if we talk about real project - you will have a lot of custom configuration and dependencies. For example, except src/ folder you may have your own dependencies in composer.json, a lot of custom configuration in app/config/*.yml files, etc, so just copying src/ folder does not enough. And probably the most important problem is that this way you lose all your Git history, i.e. you create a new project where you'll need to do "git init" which means you start with empty Git repo. Also, most probably cache and logs from the previous project won't work, so copying them is pointless.
And btw, do not forget to run your tests before pushing to production (you write tests, right?) :)
Anyway, your way looks more time consuming as for me.
Cheers!
Yes, you are right... Thanks for answer.
Hi,
After upgrading to symfony 3.0 I'm unable to get pass this error:
Invalid key "container" found in arguments of method "__construct()" for service "mailchimp": only integer or $named arguments are allowed.
Is it related to : [BC BREAK] non-numeric keys in methods and constructors arguments have never been supported and are now forbidden. Please remove them if you happen to have one.
The problem I'm having is locating where this error is happening to solve it.
Any help would be appreciated, thank you
Hey claire
Can you post your services.yml file? Look like you/or something is injecting the container into the mailchimp service in a deprecated way
Cheers!
Hey,
It pretty big so here the snippets which are using mailchimp. But if it helps i can post the whole thing.
Thank you for taking the time to help me MolloKhan :)
Yo claire!
Yes, so I do know this error. Let me explain it first (actually it looks like you found the [BC BREAK] item), and then we'll see if we can find the cause! Normally (as you do in your code) when you pass arguments to a service, it looks like this (your example above passes the arguments all on 1 line, but it's equivalent to this multi-line version)
But, in Symfony 2, it was legal to do this instead:
In this case, you're naming the keys to your arguments. This had absolutely no effect - the above to examples created identical services. In Symfony 3, we made using string keys like this illegal (we did this because we now allow named arguments https://knpuniversity.com/screencast/symfony-3.3/named-arguments).
So, somewhere in your code, someone is doing this - and using a "container" key. And the problem is indeed in the bundle: https://github.com/AlmogBaku/MailchimpBundle/blob/master/Resources/config/services.yml#L5
I think you need to find a new bundle :). A quick search reveals this one: https://github.com/AhmedSamy/HypeMailchimpBundle, though I have never used it. But honestly, the bundle you're using isn't giving you anything, besides that one service definition - https://github.com/AlmogBaku/MailchimpBundle/blob/master/Resources/config/services.yml#L5 and this one class: https://github.com/AlmogBaku/MailchimpBundle/blob/master/Mailchimp/Mailchimp.php. You could just copy those into your code very easily :).
I hope that helps!
Had a thought could it be to do with the 'godisco/mailchimp-bundle' , im on the latest version but it seems it not been updated in a while. Looking into this bundles dependency injection I see :
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.yml');
$container->setParameter("mailchimp.api_key", $config['api_key']);
$container->setParameter("mailchimp.default_list", $config['default_list']);
}
Could this be the cause? If so , what would you recommend, maybe finding a replacement bundle?
"Houston: no signs of life"
Start the conversation!