Skip to content

Removed deprecated features and notices #8622

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

Merged
merged 5 commits into from
Nov 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions best_practices/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,5 @@ through environment variables:
# ...
password: "%env(DB_PASSWORD)%"

.. versionadded:: 3.2
Support for runtime environment variables via the ``%env(...)%`` syntax
was added in Symfony 3.2. Prior to version 3.2, you needed to use the
:doc:`special SYMFONY__ variables </configuration/external_parameters>`.

.. _`feature toggles`: https://en.wikipedia.org/wiki/Feature_toggle
.. _`constant() function`: http://twig.sensiolabs.org/doc/functions/constant.html
10 changes: 0 additions & 10 deletions bundles/extension.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,10 @@ read more about it, see the ":doc:`/bundles/configuration`" article.
Adding Classes to Compile
-------------------------

.. versionadded:: 3.3
This technique is discouraged and the ``addClassesToCompile()`` method was
deprecated in Symfony 3.3 because modern PHP versions make it unnecessary.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm wrong, this versionadded says "Don't use what's descriped below." (so it's more a .. caution:: than versionadded). This means the article should be removed (as the feature got removed in Symfony 4).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I though the same ... but only addClassesToCompile() is deprecated/removed. addAnnotatedClassesToCompile() is still valid and used in Sf4.


Symfony creates a big ``classes.php`` file in the cache directory to aggregate
the contents of the PHP classes that are used in every request. This reduces the
I/O operations and increases the application performance.

.. versionadded:: 3.2
The ``addAnnotatedClassesToCompile()`` method was added in Symfony 3.2.

Your bundles can also add their own classes into this file thanks to the
``addClassesToCompile()`` and ``addAnnotatedClassesToCompile()`` methods (both
work in the same way, but the second one is for classes that contain PHP
Expand Down Expand Up @@ -173,9 +166,6 @@ class names::
If some class extends from other classes, all its parents are automatically
included in the list of classes to compile.

.. versionadded:: 3.2
The option to add classes to compile using patterns was introduced in Symfony 3.2.

The classes to compile can also be added using file path patterns::

// ...
Expand Down
107 changes: 3 additions & 104 deletions bundles/inheritance.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,107 +6,6 @@ How to Use Bundle Inheritance to Override Parts of a Bundle

.. caution::

Bundle inheritance is deprecated since Symfony 3.4 and will be removed in
4.0.

When working with third-party bundles, you'll probably come across a situation
where you want to override a file in that third-party bundle with a file
in one of your own bundles. Symfony gives you a very convenient way to override
things like controllers, templates, and other files in a bundle's
``Resources/`` directory.

For example, suppose that you have installed `FOSUserBundle`_, but you want to
override its base ``layout.html.twig`` template, as well as one of its
controllers.

First, create a new bundle called UserBundle and enable it in your application.
Then, register the third-party FOSUserBundle as the "parent" of your bundle::

// src/UserBundle/UserBundle.php
namespace UserBundle;

use Symfony\Component\HttpKernel\Bundle\Bundle;

class UserBundle extends Bundle
{
public function getParent()
{
return 'FOSUserBundle';
}
}

By making this simple change, you can now override several parts of the FOSUserBundle
simply by creating a file with the same name.

.. note::

Despite the method name, there is no parent/child relationship between
the bundles, it is just a way to extend and override an existing bundle.

Overriding Controllers
~~~~~~~~~~~~~~~~~~~~~~

Suppose you want to add some functionality to the ``registerAction()`` of a
``RegistrationController`` that lives inside FOSUserBundle. To do so,
just create your own ``RegistrationController.php`` file, override the bundle's
original method, and change its functionality::

// src/UserBundle/Controller/RegistrationController.php
namespace UserBundle\Controller;

use FOS\UserBundle\Controller\RegistrationController as BaseController;

class RegistrationController extends BaseController
{
public function registerAction()
{
$response = parent::registerAction();

// ... do custom stuff
return $response;
}
}

.. tip::

Depending on how severely you need to change the behavior, you might
call ``parent::registerAction()`` or completely replace its logic with
your own.

.. note::

Overriding controllers in this way only works if the bundle refers to
the controller using the standard ``FOSUserBundle:Registration:register``
syntax in routes and templates. This is the best practice.

Overriding Resources: Templates, Routing, etc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Most resources can also be overridden, simply by creating a file in the same
location as your parent bundle.

For example, it's very common to need to override the FOSUserBundle's
``layout.html.twig`` template so that it uses your application's base layout.
Since the file lives at ``Resources/views/layout.html.twig`` in the FOSUserBundle,
you can create your own file in the same location of UserBundle. Symfony will
ignore the file that lives inside the FOSUserBundle entirely, and use your file
instead.

The same goes for routing files and some other resources.

.. note::

The overriding of resources only works when you refer to resources with
the ``@FOSUserBundle/Resources/config/routing/security.xml`` method.
You need to use the ``@BundleName`` shortcut when referring to resources
so they can be successfully overridden (except templates, which are
overridden in a different way, as explained in :doc:`/templating/overriding`).

.. caution::

Translation and validation files do not work in the same way as described
above. Read ":ref:`override-translations`" if you want to learn how to
override translations and see ":ref:`override-validation`" for tricks to
override the validation.

.. _`FOSUserBundle`: https://github.com/friendsofsymfony/fosuserbundle
Bundle inheritance was removed in Symfony 4.0, but you can
:doc:`override any part of a bundle </bundles/override>` without
using bundle inheritance.
6 changes: 3 additions & 3 deletions bundles/override.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
How to Override any Part of a Bundle
====================================

This document is a quick reference for how to override different parts of
third-party bundles without using :doc:`/bundles/inheritance`, which is
deprecated since Symfony 3.4.
When using a third-party bundle, you might want to customize or override some of
its features. This document describes ways of overriding the most common
features of a bundle.

.. tip::

Expand Down
5 changes: 1 addition & 4 deletions components/cache.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ The Cache Component
It is designed to have a low overhead and it ships with ready to use adapters
for the most common caching backends.

.. versionadded:: 3.3
The PSR-16 "Simple Cache" implementation was introduced in Symfony 3.3.

Installation
------------

Expand Down Expand Up @@ -78,7 +75,7 @@ Now you can create, retrieve, update and delete items using this object::

// remove the cache key
$cache->delete('stats.num_products');

// clear *all* cache keys
$cache->clear();

Expand Down
4 changes: 0 additions & 4 deletions components/cache/adapters/memcached_adapter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
Memcached Cache Adapter
=======================

.. versionadded:: 3.3

The Memcached adapter was introduced in Symfony 3.3.

This adapter stores the values in-memory using one (or more) `Memcached server`_
instances. Unlike the :ref:`APCu adapter <apcu-adapter>`, and similarly to the
:ref:`Redis adapter <redis-adapter>`, it is not limited to the current server's
Expand Down
5 changes: 0 additions & 5 deletions components/cache/adapters/pdo_doctrine_dbal_adapter.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,6 @@
PDO & Doctrine DBAL Cache Adapter
=================================

.. versionadded:: 3.2

The PDO & Doctrine DBAL adapter was introduced in Symfony 3.2.


This adapter stores the cache items in an SQL database. It requires a `PDO`_,
`Doctrine DBAL Connection`_, or `Data Source Name (DSN)`_ as its first parameter, and
optionally a namespace, default cache lifetime, and options array as its second,
Expand Down
3 changes: 0 additions & 3 deletions components/cache/cache_invalidation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ The Symfony Cache component provides two mechanisms to help solving this problem
Using Cache Tags
----------------

.. versionadded:: 3.2
Tags based invalidation was introduced in Symfony 3.2.

To benefit from tags based invalidation, you need to attach the proper tags to
each cached item. Each tag is a plain string identifier that you can use at any
time to trigger the removal of all items associated with this tag.
Expand Down
9 changes: 0 additions & 9 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -186,20 +186,11 @@ Or you may define a prototype for each node inside an array node::
->end()
;

.. versionadded:: 3.3
The ``arrayPrototype()`` method (and the related ``booleanPrototype()``
``integerPrototype()``, ``floatPrototype()``, ``scalarPrototype()`` and
``enumPrototype()``) was introduced in Symfony 3.3. In previous versions,
you needed to use ``prototype('array')``, ``prototype('boolean')``, etc.

A prototype can be used to add a definition which may be repeated many times
inside the current node. According to the prototype definition in the example
above, it is possible to have multiple connection arrays (containing a ``driver``,
``host``, etc.).

.. versionadded:: 3.3
The ``castToArray()`` helper was added in Symfony 3.3.

Sometimes, to improve the user experience of your application or bundle, you may
allow to use a simple string or numeric value where an array value is required.
Use the ``castToArray()`` helper to turn those variables into arrays::
Expand Down
34 changes: 9 additions & 25 deletions components/console/events.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,27 +83,24 @@ C/C++ standard.::
}
});

The ``ConsoleEvents::EXCEPTION`` Event
--------------------------------------

.. versionadded:: 3.3
The ``ConsoleEvents::EXCEPTION`` event was deprecated in Symfony 3.3. Use
the ``ConsoleEvents::ERROR`` event instead.
The ``ConsoleEvents::ERROR`` Event
----------------------------------

**Typical Purposes**: Handle exceptions thrown during the execution of a
command.

Whenever an exception is thrown by a command, the ``ConsoleEvents::EXCEPTION``
event is dispatched. A listener can wrap or change the exception or do
anything useful before the exception is thrown by the application.
Whenever an exception is thrown by a command, including those triggered from
event listeners, the ``ConsoleEvents::ERROR`` event is dispatched. A listener
can wrap or change the exception or do anything useful before the exception is
thrown by the application.

Listeners receive a
:class:`Symfony\\Component\\Console\\Event\\ConsoleExceptionEvent` event::

use Symfony\Component\Console\Event\ConsoleExceptionEvent;
use Symfony\Component\Console\Event\ConsoleErrorEvent;
use Symfony\Component\Console\ConsoleEvents;

$dispatcher->addListener(ConsoleEvents::EXCEPTION, function (ConsoleExceptionEvent $event) {
$dispatcher->addListener(ConsoleEvents::ERROR, function (ConsoleErrorEvent $event) {
$output = $event->getOutput();

$command = $event->getCommand();
Expand All @@ -114,22 +111,9 @@ Listeners receive a
$exitCode = $event->getExitCode();

// change the exception to another one
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getException()));
$event->setException(new \LogicException('Caught exception', $exitCode, $event->getError()));
});

The ``ConsoleEvents::ERROR`` Event
----------------------------------

.. versionadded:: 3.3
The ``ConsoleEvents::ERROR`` event was introduced in Symfony 3.3.

**Typical Purposes**: Handle exceptions thrown during the execution of a
command.

This event is an improved version of the ``ConsoleEvents::EXCEPTION`` event,
because it can handle every exception thrown during the execution of a command,
including those triggered from event listeners.

The ``ConsoleEvents::TERMINATE`` Event
--------------------------------------

Expand Down
12 changes: 3 additions & 9 deletions components/console/helpers/questionhelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ will be autocompleted as the user types::
{
// ...
$helper = $this->getHelper('question');

$bundles = array('AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle');
$question = new Question('Please enter the name of a bundle', 'FooBundle');
$question->setAutocompleterValues($bundles);
Expand All @@ -191,7 +191,7 @@ convenient for passwords::
{
// ...
$helper = $this->getHelper('question');

$question = new Question('What is the database password?');
$question->setHidden(true);
$question->setHiddenFallback(false);
Expand Down Expand Up @@ -229,9 +229,6 @@ convenient for passwords::
// ...
}

.. versionadded:: 3.3
The ``QuestionHelper::disableStty()`` method was introduced in Symfony 3.3.

Normalizing the Answer
----------------------

Expand All @@ -249,7 +246,7 @@ method::
{
// ...
$helper = $this->getHelper('question');

$question = new Question('Please enter the name of the bundle', 'AppBundle');
$question->setNormalizer(function ($value) {
// $value can be null here
Expand Down Expand Up @@ -369,9 +366,6 @@ from the command line, you need to set the inputs that the command expects::
// $this->assertRegExp('/.../', $commandTester->getDisplay());
}

.. versionadded:: 3.2
The ``CommandTester::setInputs()`` method was introduced in Symfony 3.2.

By calling :method:`Symfony\\Component\\Console\\Tester\\CommandTester::setInputs`,
you imitate what the console would do internally with all user input through the CLI.
This method takes an array as only argument with, for each input that the command expects,
Expand Down
3 changes: 0 additions & 3 deletions components/console/logger.rst
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,6 @@ constructor::
Errors
------

.. versionadded:: 3.2
The ``hasErrored()`` method was introduced in Symfony 3.2.

The Console logger includes a ``hasErrored()`` method which returns ``true`` as
soon as any error message has been logged during the execution of the command.
This is useful to decide which status code to return as the result of executing
Expand Down
5 changes: 0 additions & 5 deletions components/console/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,3 @@ can run it with:
If you enter a short command that's ambiguous (i.e. there are more than one
command that match), then no command will be run and some suggestions of
the possible commands to choose from will be output.

.. versionadded:: 3.4
Case-insensitivity of command shortcuts was introduced in Symfony 3.4. In
previous Symfony versions, shortcuts had to match the case of the original
command name (e.g. ``d:g`` was not the same shortcut as ``D:G``).
3 changes: 0 additions & 3 deletions components/dependency_injection/compilation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,6 @@ been run, use::
PassConfig::TYPE_AFTER_REMOVING
);

.. versionadded:: 3.2
The option to prioritize compiler passes was added in Symfony 3.2.

You can also control the order in which compiler passes are run for each
compilation phase. Use the optional third argument of ``addCompilerPass()`` to
set the priority as an integer number. The default priority is ``0`` and the higher
Expand Down
Loading