Commit 8b7796f9 authored by Fabien Potencier's avatar Fabien Potencier

merged branch igorw/autoloader-exception (PR #347)

Commits
-------

7ecfd533 Re-add a SymfonyBridgesServiceProvider that throws an exception
3ed4cdf6 Add exceptions for removed autoloader service and class_loader parameters

Discussion
----------

Add exceptions for removed features

As I said before, we need to tell the users about removed features. We cannot expect them to constantly check the changelog, and I refuse to spend my time providing support because of this.

This PR adds exceptions for the autoloader service, all of the *.class_path parameters and the SymfonyBridgesServiceProvider. Those exceptions should give the user at least some idea about what is going on, and hopefully reduce the amount of support tickets we get.

We can remove these exceptions when we release 1.0.0-RC1.

---------------------------------------------------------------------------

by neurolit at 2012-06-03T18:02:34Z

I totally agree with you. It's quite painful to maintain a webapp based on Silex, as APIs are changing all the time. Such exceptions would be of much help!
parents ea521424 7ecfd533
......@@ -60,6 +60,10 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
$this['logger'] = null;
$this['autoloader'] = function () {
throw new \RuntimeException('You tried to access the autoloader service. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. See http://getcomposer.org for more information.');
};
$this['routes'] = $this->share(function () {
return new RouteCollection();
});
......
......@@ -118,6 +118,14 @@ class DoctrineServiceProvider implements ServiceProviderInterface
return $dbs[$app['dbs.default']];
});
if (isset($app['db.dbal.class_path'])) {
throw new \RuntimeException('You have provided the db.dbal.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
if (isset($app['db.common.class_path'])) {
throw new \RuntimeException('You have provided the db.common.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
}
public function boot(Application $app)
......
......@@ -51,6 +51,10 @@ class FormServiceProvider implements ServiceProviderInterface
return new DefaultCsrfProvider($app['form.secret']);
});
if (isset($app['form.class_path'])) {
throw new \RuntimeException('You have provided the form.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
}
public function boot(Application $app)
......
......@@ -56,6 +56,10 @@ class MonologServiceProvider implements ServiceProviderInterface
return Logger::DEBUG;
};
}
if (isset($app['monolog.class_path'])) {
throw new \RuntimeException('You have provided the monolog.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
}
public function boot(Application $app)
......
<?php
/*
* This file is part of the Silex framework.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Silex\Provider;
use Silex\Application;
use Silex\ServiceProviderInterface;
/**
* Symfony bridges Provider.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SymfonyBridgesServiceProvider implements ServiceProviderInterface
{
public function __construct()
{
throw new \RuntimeException('You tried to create a SymfonyBridgesServiceProvider. However, it has been removed from Silex. Make sure that the Symfony bridge you want to use is autoloadable, and it will get loaded automatically. You should remove the creation of the SymfonyBridgesServiceProvider, as it is no longer needed.');
}
public function register(Application $app)
{
}
public function boot(Application $app)
{
}
}
......@@ -52,6 +52,10 @@ class TranslationServiceProvider implements ServiceProviderInterface
$app['translator.message_selector'] = $app->share(function () {
return new MessageSelector();
});
if (isset($app['translation.class_path'])) {
throw new \RuntimeException('You have provided the translation.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
}
public function boot(Application $app)
......
......@@ -89,6 +89,10 @@ class TwigServiceProvider implements ServiceProviderInterface
$app['twig.loader.array'],
));
});
if (isset($app['twig.class_path'])) {
throw new \RuntimeException('You have provided the twig.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
}
public function boot(Application $app)
......
......@@ -53,6 +53,10 @@ class ValidatorServiceProvider implements ServiceProviderInterface
$app['validator.validator_factory'] = $app->share(function () {
return new ConstraintValidatorFactory();
});
if (isset($app['validator.class_path'])) {
throw new \RuntimeException('You have provided the validator.class_path parameter. The autoloader has been removed from Silex. It is recommended that you use Composer to manage your dependencies and handle your autoloading. If you are already using Composer, you can remove the parameter. See http://getcomposer.org for more information.');
}
}
public function boot(Application $app)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment