Attempted to call method "share" on class "Silex\Application" in Silex 2 Attempted to call method "share" on class "Silex\Application" in Silex 2 symfony symfony

Attempted to call method "share" on class "Silex\Application" in Silex 2


Silex 2.0 is using Pimple 3.0 which has removed the shared method, now all services are shared by default, if you want a new instance you must call the factory method as stated in the changelog for version 2.0.

So if you want a login service you should create it like this:

<?php$app['login'] = function($app) {    return new Model\UserModel($app);};

You can take a look at the docs for the 3.0 Pimple version directly on it's GitHub repository

PS: Keep in mind that, at the time of this writing, Silex 2.0 is in development, so be prepared to adapt your code until it gets a 2.0 stable version. 2.0 has reached prod status as of 2016-05-18