Commit 9eb53b54 authored by Fabien Potencier's avatar Fabien Potencier

renamed *Provider classes to *ServiceProvider

parent a7894570
This changelog references all backward incompatibilities as we introduce them:
* 2011-21-09: `ExtensionInterface` has been renamed to
`ServiceProviderInterface`.
`ServiceProviderInterface`. All built-in extensions have been renamed
accordingly (for instance, `Silex\Extension\TwigExtension` has been renamed
to `Silex\Provider\TwigServiceProvider`)
* 2011-21-09: The way reusable applications work has changed. The `mount()`
method now takes an instance of `ControllerCollection` instead of an
......
......@@ -11,4 +11,4 @@ Silex
testing
internals
contributing
extensions/index
providers/index
DoctrineProvider
================
DoctrineServiceProvider
=======================
The *DoctrineProvider* provides integration with the `Doctrine DBAL
The *DoctrineServiceProvider* provides integration with the `Doctrine DBAL
<http://www.doctrine-project.org/projects/dbal>`_ for easy database acccess.
.. note::
......@@ -58,7 +58,7 @@ Registering
Make sure you place a copy of *Doctrine DBAL* in ``vendor/doctrine-dbal``
and *Doctrine Common* in ``vendor/doctrine-common``::
$app->register(new Silex\Provider\DoctrineProvider(), array(
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'db.options' => array(
'driver' => 'pdo_sqlite',
'path' => __DIR__.'/app.db',
......@@ -89,7 +89,7 @@ configure the data sources, replace the **db.options** with **dbs.options**.
**dbs.options** is an array of configurations where keys are connection names
and values are options::
$app->register(new Silex\Provider\DoctrineProvider(), array(
$app->register(new Silex\Provider\DoctrineServiceProvider(), array(
'dbs.options' => array (
'mysql_read' => array(
'driver' => 'pdo_mysql',
......
HttpCacheProvider
=================
HttpCacheServiceProvider
========================
The *HttpCacheProvider* provides support for the Symfony2 Reverse Proxy.
......@@ -23,7 +23,7 @@ Registering
::
$app->register(new Silex\Provider\HttpCacheProvider(), array(
$app->register(new Silex\Provider\HttpCacheServiceProvider(), array(
'http_cache.cache_dir' => __DIR__.'/cache/',
));
......
MonologProvider
===============
MonologServiceProvider
======================
The *MonologProvider* provides a default logging mechanism
The *MonologServiceProvider* provides a default logging mechanism
through Jordi Boggiano's `Monolog <https://github.com/Seldaek/monolog>`_
library.
......@@ -46,7 +46,7 @@ Registering
Make sure you place a copy of *Monolog* in the ``vendor/monolog``
directory::
$app->register(new Silex\Provider\MonologProvider(), array(
$app->register(new Silex\Provider\MonologServiceProvider(), array(
'monolog.logfile' => __DIR__.'/development.log',
'monolog.class_path' => __DIR__.'/vendor/monolog/src',
));
......@@ -59,7 +59,7 @@ directory::
Usage
-----
The MonologProvider provides a ``monolog`` service. You can use
The MonologServiceProvider provides a ``monolog`` service. You can use
it to add log entries for any logging level through ``addDebug()``,
``addInfo()``, ``addWarning()`` and ``addError()``.
......
SessionProvider
===============
SessionServiceProvider
======================
The *SessionProvider* provides a service for storing data persistently
The *SessionServiceProvider* provides a service for storing data persistently
between requests.
Parameters
......@@ -40,7 +40,7 @@ Registering
::
$app->register(new Silex\Provider\SessionProvider());
$app->register(new Silex\Provider\SessionServiceProvider());
Usage
-----
......
TranslationProvider
===================
TranslationServiceProvider
==========================
The *TranslationProvider* provides a service for translating your application
The *TranslationServiceProvider* provides a service for translating your application
into different languages.
Parameters
......@@ -40,7 +40,7 @@ Registering
Make sure you place a copy of the Symfony2 Translation component in
``vendor/symfony/src``. You can simply clone the whole Symfony2 into vendor::
$app->register(new Silex\Provider\TranslationProvider(), array(
$app->register(new Silex\Provider\TranslationServiceProvider(), array(
'locale_fallback' => 'en',
'translation.class_path' => __DIR__.'/vendor/symfony/src',
));
......
TwigProvider
============
TwigServiceProvider
===================
The *TwigProvider* provides integration with the `Twig
The *TwigServiceProvider* provides integration with the `Twig
<http://twig.sensiolabs.org/>`_ template engine.
Parameters
......@@ -39,7 +39,7 @@ Registering
Make sure you place a copy of *Twig* in the ``vendor/twig``
directory::
$app->register(new Silex\Provider\TwigProvider(), array(
$app->register(new Silex\Provider\TwigServiceProvider(), array(
'twig.path' => __DIR__.'/views',
'twig.class_path' => __DIR__.'/vendor/twig/lib',
));
......@@ -66,7 +66,14 @@ In any Twig template, the ``app`` variable refers to the Application object.
So you can access any services from within your view. For example to access
``$app['request']->getHost()``, just put this in your template:
<<<<<<< HEAD
.. code-block:: jinja
=======
The TwigServiceProvider also registers the application as a global
named ``app``. So you can access any services from within your
view. For example to access ``$app['request']->getHost()``,
just put this in your template:
>>>>>>> renamed *Provider classes to *ServiceProvider
{{ app.request.host }}
......
UrlGeneratorProvider
====================
UrlGeneratorServiceProvider
===========================
The *UrlGeneratorProvider* provides a service for generating
The *UrlGeneratorServiceProvider* provides a service for generating
URLs for named routes.
Parameters
......@@ -25,7 +25,7 @@ Registering
::
$app->register(new Silex\Provider\UrlGeneratorProvider());
$app->register(new Silex\Provider\UrlGeneratorServiceProvider());
Usage
-----
......
ValidatorProvider
=================
ValidatorServiceProvider
========================
The *ValidatorProvider* provides a service for validating data. It is
most useful when used with the *FormProvider*, but can also be used
The *ValidatorServiceProvider* provides a service for validating data. It is
most useful when used with the *FormServiceProvider*, but can also be used
standalone.
Parameters
......@@ -35,7 +35,7 @@ Registering
Make sure you place a copy of the Symfony2 Validator component in
``vendor/symfony/src``. You can simply clone the whole Symfony2 into vendor::
$app->register(new Silex\Provider\ValidatorProvider(), array(
$app->register(new Silex\Provider\ValidatorServiceProvider(), array(
'validator.class_path' => __DIR__.'/vendor/symfony/src',
));
......@@ -93,7 +93,7 @@ getters::
});
You will have to handle the display of these violations yourself. You can
however use the *FormProvider* which can make use of the *ValidatorProvider*.
however use the *FormServiceProvider* which can make use of the *ValidatorServiceProvider*.
For more information, consult the `Symfony2 Validation documentation
<http://symfony.com/doc/2.0/book/validation.html>`_.
......@@ -22,7 +22,7 @@ use Doctrine\Common\EventManager;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DoctrineProvider implements ServiceProviderInterface
class DoctrineServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -25,7 +25,7 @@ use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class FormProvider implements ServiceProviderInterface
class FormServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -22,7 +22,7 @@ use Symfony\Component\HttpKernel\HttpCache\Store;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class HttpCacheProvider implements ServiceProviderInterface
class HttpCacheServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -24,7 +24,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class MonologProvider implements ServiceProviderInterface
class MonologServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -23,7 +23,7 @@ use Symfony\Component\HttpKernel\KernelEvents;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SessionProvider implements ServiceProviderInterface
class SessionServiceProvider implements ServiceProviderInterface
{
private $app;
......
......@@ -19,7 +19,7 @@ use Silex\ServiceProviderInterface;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SwiftmailerProvider implements ServiceProviderInterface
class SwiftmailerServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -19,7 +19,7 @@ use Silex\ServiceProviderInterface;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SymfonyBridgesProvider implements ServiceProviderInterface
class SymfonyBridgesServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -23,7 +23,7 @@ use Symfony\Component\Translation\Loader\ArrayLoader;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TranslationProvider implements ServiceProviderInterface
class TranslationServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -23,7 +23,7 @@ use Symfony\Bridge\Twig\Extension\FormExtension as TwigFormExtension;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class TwigProvider implements ServiceProviderInterface
class TwigServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -21,7 +21,7 @@ use Symfony\Component\Routing\Generator\UrlGenerator;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class UrlGeneratorProvider implements ServiceProviderInterface
class UrlGeneratorServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -24,7 +24,7 @@ use Symfony\Component\Validator\ConstraintValidatorFactory;
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ValidatorProvider implements ServiceProviderInterface
class ValidatorServiceProvider implements ServiceProviderInterface
{
public function register(Application $app)
{
......
......@@ -12,14 +12,14 @@
namespace Silex\Tests\Provider;
use Silex\Application;
use Silex\Provider\DoctrineProvider;
use Silex\Provider\DoctrineServiceProvider;
/**
* DoctrineProvider test cases.
*
* Fabien Potencier <fabien@symfony.com>
*/
class DoctrineProviderTest extends \PHPUnit_Framework_TestCase
class DoctrineServiceProviderTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
......@@ -31,7 +31,7 @@ class DoctrineProviderTest extends \PHPUnit_Framework_TestCase
public function testSingleConnection()
{
$app = new Application();
$app->register(new DoctrineProvider(), array(
$app->register(new DoctrineServiceProvider(), array(
'db.common.class_path' => __DIR__.'/../../../../vendor/doctrine-common/lib',
'db.dbal.class_path' => __DIR__.'/../../../../vendor/doctrine-dbal/lib',
......@@ -51,7 +51,7 @@ class DoctrineProviderTest extends \PHPUnit_Framework_TestCase
public function testMultipleConnections()
{
$app = new Application();
$app->register(new DoctrineProvider(), array(
$app->register(new DoctrineServiceProvider(), array(
'db.common.class_path' => __DIR__.'/../../../../vendor/doctrine-common/lib',
'db.dbal.class_path' => __DIR__.'/../../../../vendor/doctrine-dbal/lib',
......
......@@ -14,7 +14,7 @@ namespace Silex\Tests\Provider;
use Monolog\Handler\TestHandler;
use Silex\Application;
use Silex\Provider\MonologProvider;
use Silex\Provider\MonologServiceProvider;
use Symfony\Component\HttpFoundation\Request;
......@@ -23,7 +23,7 @@ use Symfony\Component\HttpFoundation\Request;
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class MonologProviderTest extends \PHPUnit_Framework_TestCase
class MonologServiceProviderTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
......@@ -36,7 +36,7 @@ class MonologProviderTest extends \PHPUnit_Framework_TestCase
{
$app = new Application();
$app->register(new MonologProvider(), array(
$app->register(new MonologServiceProvider(), array(
'monolog.class_path' => __DIR__.'/../../../../vendor/monolog/src',
));
......
......@@ -12,7 +12,7 @@
namespace Silex\Tests\Provider;
use Silex\Application;
use Silex\Provider\SessionProvider;
use Silex\Provider\SessionServiceProvider;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage;
......@@ -22,13 +22,13 @@ use Symfony\Component\HttpFoundation\SessionStorage\ArraySessionStorage;
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class SessionProviderTest extends \PHPUnit_Framework_TestCase
class SessionServiceProviderTest extends \PHPUnit_Framework_TestCase
{
public function testRegister()
{
$app = new Application();
$app->register(new SessionProvider());
$app->register(new SessionServiceProvider());
$app['session.storage'] = $app->share(function () use ($app) {
return new ArraySessionStorage();
......
......@@ -12,7 +12,7 @@
namespace Silex\Tests\Provider;
use Silex\Application;
use Silex\Provider\TwigProvider;
use Silex\Provider\TwigServiceProvider;
use Symfony\Component\HttpFoundation\Request;
......@@ -21,7 +21,7 @@ use Symfony\Component\HttpFoundation\Request;
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class TwigProviderTest extends \PHPUnit_Framework_TestCase
class TwigServiceProviderTest extends \PHPUnit_Framework_TestCase
{
public function setUp()
{
......@@ -34,7 +34,7 @@ class TwigProviderTest extends \PHPUnit_Framework_TestCase
{
$app = new Application();
$app->register(new TwigProvider(), array(
$app->register(new TwigServiceProvider(), array(
'twig.templates' => array('hello' => 'Hello {{ name }}!'),
'twig.class_path' => __DIR__.'/../../../../vendor/twig/lib',
));
......
......@@ -12,7 +12,7 @@
namespace Silex\Tests\Provider;
use Silex\Application;
use Silex\Provider\UrlGeneratorProvider;
use Silex\Provider\UrlGeneratorServiceProvider;
use Symfony\Component\HttpFoundation\Request;
......@@ -21,13 +21,13 @@ use Symfony\Component\HttpFoundation\Request;
*
* @author Igor Wiedler <igor@wiedler.ch>
*/
class UrlGeneratorProviderTest extends \PHPUnit_Framework_TestCase
class UrlGeneratorServiceProviderTest extends \PHPUnit_Framework_TestCase
{
public function testRegister()
{
$app = new Application();
$app->register(new UrlGeneratorProvider());
$app->register(new UrlGeneratorServiceProvider());
$app->get('/hello/{name}', function ($name) {})
->bind('hello');
......@@ -44,7 +44,7 @@ class UrlGeneratorProviderTest extends \PHPUnit_Framework_TestCase
{
$app = new Application();
$app->register(new UrlGeneratorProvider());
$app->register(new UrlGeneratorServiceProvider());
$app->get('/hello/{name}', function ($name) {})
->bind('hello');
......@@ -63,7 +63,7 @@ class UrlGeneratorProviderTest extends \PHPUnit_Framework_TestCase
{
$app = new Application();
$app->register(new UrlGeneratorProvider());
$app->register(new UrlGeneratorServiceProvider());
$app->get('/hello/{name}', function ($name) {})
->bind('hello');
......@@ -82,7 +82,7 @@ class UrlGeneratorProviderTest extends \PHPUnit_Framework_TestCase
{
$app = new Application();
$app->register(new UrlGeneratorProvider());
$app->register(new UrlGeneratorServiceProvider());
$app->get('/insecure', function () {})
->bind('insecure_page')
......@@ -102,7 +102,7 @@ class UrlGeneratorProviderTest extends \PHPUnit_Framework_TestCase
{
$app = new Application();
$app->register(new UrlGeneratorProvider());
$app->register(new UrlGeneratorServiceProvider());
$app->get('/secure', function () {})
->bind('secure_page')
......
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