Skip to content

Commit 504ea87

Browse files
committed
Merge branch '4.0'
* 4.0: Adding a documentation page about Bootstrap 4 form theme Ask users to create two commits for reproducers Improved variable naming
2 parents 727fc74 + 8cd3a84 commit 504ea87

16 files changed

+80
-68
lines changed

components/cache.rst

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,43 +60,43 @@ instantiate :class:`Symfony\\Component\\Cache\\Simple\\FilesystemCache`::
6060
Now you can create, retrieve, update and delete items using this object::
6161

6262
// save a new item in the cache
63-
$cache->set('stats.num_products', 4711);
63+
$cache->set('stats.products_count', 4711);
6464

6565
// or set it with a custom ttl
66-
// $cache->set('stats.num_products', 4711, 3600);
66+
// $cache->set('stats.products_count', 4711, 3600);
6767

6868
// retrieve the cache item
69-
if (!$cache->has('stats.num_products')) {
69+
if (!$cache->has('stats.products_count')) {
7070
// ... item does not exists in the cache
7171
}
7272

7373
// retrieve the value stored by the item
74-
$numProducts = $cache->get('stats.num_products');
74+
$productsCount = $cache->get('stats.products_count');
7575

7676
// or specify a default value, if the key doesn't exist
77-
// $numProducts = $cache->get('stats.num_products', 100);
77+
// $productsCount = $cache->get('stats.products_count', 100);
7878

7979
// remove the cache key
80-
$cache->delete('stats.num_products');
80+
$cache->delete('stats.products_count');
8181

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

8585
You can also work with multiple items at once::
8686

8787
$cache->setMultiple(array(
88-
'stats.num_products' => 4711,
89-
'stats.num_users' => 1356,
88+
'stats.products_count' => 4711,
89+
'stats.users_count' => 1356,
9090
));
9191

9292
$stats = $cache->getMultiple(array(
93-
'stats.num_products',
94-
'stats.num_users',
93+
'stats.products_count',
94+
'stats.users_count',
9595
));
9696

9797
$cache->deleteMultiple(array(
98-
'stats.num_products',
99-
'stats.num_users',
98+
'stats.products_count',
99+
'stats.users_count',
100100
));
101101

102102
Available Simple Cache (PSR-16) Classes
@@ -159,22 +159,22 @@ a filesystem-based cache, instantiate :class:`Symfony\\Component\\Cache\\Adapter
159159
Now you can create, retrieve, update and delete items using this cache pool::
160160

161161
// create a new item by trying to get it from the cache
162-
$numProducts = $cache->getItem('stats.num_products');
162+
$productsCount = $cache->getItem('stats.products_count');
163163

164164
// assign a value to the item and save it
165-
$numProducts->set(4711);
166-
$cache->save($numProducts);
165+
$productsCount->set(4711);
166+
$cache->save($productsCount);
167167

168168
// retrieve the cache item
169-
$numProducts = $cache->getItem('stats.num_products');
170-
if (!$numProducts->isHit()) {
169+
$productsCount = $cache->getItem('stats.products_count');
170+
if (!$productsCount->isHit()) {
171171
// ... item does not exists in the cache
172172
}
173173
// retrieve the value stored by the item
174-
$total = $numProducts->get();
174+
$total = $productsCount->get();
175175

176176
// remove the cache item
177-
$cache->deleteItem('stats.num_products');
177+
$cache->deleteItem('stats.products_count');
178178

179179
For a list of all of the supported adapters, see :doc:`/components/cache/cache_pools`.
180180

components/cache/adapters/doctrine_adapter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ third parameters::
2020

2121
$provider = new SQLite3Cache(new \SQLite3(__DIR__.'/cache/data.sqlite'), 'youTableName');
2222

23-
$symfonyCache = new DoctrineAdapter(
23+
$cache = new DoctrineAdapter(
2424

2525
// a cache provider instance
2626
CacheProvider $provider,

components/cache/adapters/php_array_cache_adapter.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ that is optimized and preloaded into OPcache memory storage::
1515
if ($needsWarmup) {
1616
// some static values
1717
$values = array(
18-
'stats.num_products' => 4711,
19-
'stats.num_users' => 1356,
18+
'stats.products_count' => 4711,
19+
'stats.users_count' => 1356,
2020
);
2121

2222
$cache = new PhpArrayAdapter(
@@ -29,7 +29,7 @@ that is optimized and preloaded into OPcache memory storage::
2929
}
3030

3131
// ... then, use the cache!
32-
$cacheItem = $cache->getItem('stats.num_users');
32+
$cacheItem = $cache->getItem('stats.users_count');
3333
echo $cacheItem->get();
3434

3535
.. note::

components/cache/cache_items.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,21 @@ Cache items are created with the ``getItem($key)`` method of the cache pool. The
3131
argument is the key of the item::
3232

3333
// $cache pool object was created before
34-
$numProducts = $cache->getItem('stats.num_products');
34+
$productsCount = $cache->getItem('stats.products_count');
3535

3636
Then, use the :method:`Psr\\Cache\\CacheItemInterface::set` method to set
3737
the data stored in the cache item::
3838

3939
// storing a simple integer
40-
$numProducts->set(4711);
41-
$cache->save($numProducts);
40+
$productsCount->set(4711);
41+
$cache->save($productsCount);
4242

4343
// storing an array
44-
$numProducts->set(array(
44+
$productsCount->set(array(
4545
'category1' => 4711,
4646
'category2' => 2387,
4747
));
48-
$cache->save($numProducts);
48+
$cache->save($productsCount);
4949

5050
The key and the value of any given cache item can be obtained with the
5151
corresponding *getter* methods::

components/filesystem.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,10 @@ The :method:`Symfony\\Component\\Filesystem\\Filesystem::readlink` method provid
222222
by the Filesystem component always behaves in the same way::
223223

224224
// returns the next direct target of the link without considering the existence of the target
225-
$fs->readlink('/path/to/link');
225+
$fileSystem->readlink('/path/to/link');
226226

227227
// returns its absolute fully resolved final version of the target (if there are nested links, they are resolved)
228-
$fs->readlink('/path/to/link', true);
228+
$fileSystem->readlink('/path/to/link', true);
229229

230230
Its behavior is the following::
231231

@@ -297,7 +297,7 @@ appendToFile
297297
:method:`Symfony\\Component\\Filesystem\\Filesystem::appendToFile` adds new
298298
contents at the end of some file::
299299

300-
$fs->appendToFile('logs.txt', 'Email sent to [email protected]');
300+
$fileSystem->appendToFile('logs.txt', 'Email sent to [email protected]');
301301

302302
If either the file or its containing directory doesn't exist, this method
303303
creates them before appending the contents.

components/ldap.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,19 @@ delete existing ones::
118118
'objectClass' => array('inetOrgPerson'),
119119
));
120120

121-
$em = $ldap->getEntryManager();
121+
$entityManager = $ldap->getEntryManager();
122122

123123
// Creating a new entry
124-
$em->add($entry);
124+
$entityManager->add($entry);
125125

126126
// Finding and updating an existing entry
127127
$query = $ldap->query('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
128128
$result = $query->execute();
129129
$entry = $result[0];
130130
$entry->setAttribute('email', array('[email protected]'));
131-
$em->update($entry);
131+
$entityManager->update($entry);
132132

133133
// Removing an existing entry
134-
$em->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
134+
$entityManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));
135135

136136
.. _Packagist: https://packagist.org/packages/symfony/ldap

components/routing.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,8 @@ routes with UTF-8 characters:
405405
use Symfony\Component\Routing\RouteCollection;
406406
use Symfony\Component\Routing\Route;
407407
408-
$collection = new RouteCollection();
409-
$collection->add('route1', new Route('/category/{name}',
408+
$routes = new RouteCollection();
409+
$routes->add('route1', new Route('/category/{name}',
410410
array(
411411
'_controller' => 'App\Controller\DefaultController::category',
412412
),
@@ -418,7 +418,7 @@ routes with UTF-8 characters:
418418
419419
// ...
420420
421-
return $collection;
421+
return $routes;
422422
423423
In this route, the ``utf8`` option set to ``true`` makes Symfony consider the
424424
``.`` requirement to match any UTF-8 characters instead of just a single
@@ -482,8 +482,8 @@ You can also include UTF-8 strings as routing requirements:
482482
use Symfony\Component\Routing\RouteCollection;
483483
use Symfony\Component\Routing\Route;
484484
485-
$collection = new RouteCollection();
486-
$collection->add('route2', new Route('/default/{default}',
485+
$routes = new RouteCollection();
486+
$routes->add('route2', new Route('/default/{default}',
487487
array(
488488
'_controller' => 'App\Controller\DefaultController::default',
489489
),
@@ -497,7 +497,7 @@ You can also include UTF-8 strings as routing requirements:
497497
498498
// ...
499499
500-
return $collection;
500+
return $routes;
501501
502502
.. tip::
503503

console/lazy_commands.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ with command names as keys and service identifiers as values::
6868
use Symfony\Component\Console\CommandLoader\ContainerCommandLoader;
6969
use Symfony\Component\DependencyInjection\ContainerBuilder;
7070

71-
$container = new ContainerBuilder();
72-
$container->register(FooCommand::class, FooCommand::class);
73-
$container->compile();
71+
$containerBuilder = new ContainerBuilder();
72+
$containerBuilder->register(FooCommand::class, FooCommand::class);
73+
$containerBuilder->compile();
7474

75-
$commandLoader = new ContainerCommandLoader($container, array(
75+
$commandLoader = new ContainerCommandLoader($containerBuilder, array(
7676
'app:foo' => FooCommand::class,
7777
));
7878

7979
Like this, executing the ``app:foo`` command will load the ``FooCommand`` service
80-
by calling ``$container->get(FooCommand::class)``.
80+
by calling ``$containerBuilder->get(FooCommand::class)``.

contributing/code/reproducer.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@ Reproducing Complex Bugs
3535
If the bug is related to the Symfony Framework or if it's too complex to create
3636
a PHP script, it's better to reproduce the bug by creating a new project. To do so:
3737

38-
1. Create a new project:
38+
#. Create a new project:
3939

4040
.. code-block:: terminal
4141
4242
$ composer create-project symfony/skeleton bug_app
4343
44-
2. Now you must add the minimum amount of code to reproduce the bug. This is the
44+
#. Add and commit the changes generated by Symfony.
45+
#. Now you must add the minimum amount of code to reproduce the bug. This is the
4546
trickiest part and it's explained a bit more later.
46-
3. Add and commit your changes.
47-
4. Create a `new repository`_ on GitHub (give it any name).
48-
5. Follow the instructions on GitHub to add the ``origin`` remote to your local project
47+
#. Add and commit your changes.
48+
#. Create a `new repository`_ on GitHub (give it any name).
49+
#. Follow the instructions on GitHub to add the ``origin`` remote to your local project
4950
and push it.
50-
6. Add a comment in your original issue report to share the URL of your forked
51+
#. Add a comment in your original issue report to share the URL of your forked
5152
project (e.g. ``https://github.com/YOUR-GITHUB-USERNAME/symfony_issue_23567``)
5253
and, if necessary, explain the steps to reproduce (e.g. "browse this URL",
5354
"fill in this data in the form and submit it", etc.)

event_dispatcher/method_behavior.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,10 @@ could listen to the ``mailer.post_send`` event and change the method's return va
121121
{
122122
public function onMailerPostSend(AfterSendMailEvent $event)
123123
{
124-
$ret = $event->getReturnValue();
125-
// modify the original ``$ret`` value
124+
$returnValue = $event->getReturnValue();
125+
// modify the original ``$returnValue`` value
126126

127-
$event->setReturnValue($ret);
127+
$event->setReturnValue($returnValue);
128128
}
129129

130130
public static function getSubscribedEvents()

form/create_custom_field_type.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,14 +296,14 @@ add a ``__construct()`` method like normal::
296296

297297
class ShippingType extends AbstractType
298298
{
299-
private $em;
299+
private $entityManager;
300300

301-
public function __construct(EntityManagerInterface $em)
301+
public function __construct(EntityManagerInterface $entityManager)
302302
{
303-
$this->em = $em;
303+
$this->entityManager = $entityManager;
304304
}
305305

306-
// use $this->em down anywhere you want ...
306+
// use $this->entityManager down anywhere you want ...
307307
}
308308

309309
If you're using the default ``services.yaml`` configuration (i.e. services from the

form/form_dependencies.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ create your form::
3636
// ...
3737
public function new()
3838
{
39-
$em = $this->getDoctrine()->getManager();
39+
$entityManager = $this->getDoctrine()->getManager();
4040

4141
$task = ...;
4242
$form = $this->createForm(TaskType::class, $task, array(
43-
'entity_manager' => $em,
43+
'entity_manager' => $entityManager,
4444
));
4545

4646
// ...

form/unit_testing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ The simplest ``TypeTestCase`` implementation looks like the following::
5757
// submit the data to the form directly
5858
$form->submit($formData);
5959

60-
$objectToCompare = $form->getData();
6160
$this->assertTrue($form->isSynchronized());
61+
62+
// check that $objectToCompare was modified as expected when the form was submitted
6263
$this->assertEquals($object, $objectToCompare);
6364

6465
$view = $form->createView();

security/form_login_setup.rst

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,17 @@ Great! Next, add the logic to ``login()`` that displays the login form::
144144
// src/Controller/SecurityController.php
145145
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
146146

147+
<<<<<<< HEAD
147148
public function login(Request $request, AuthenticationUtils $authUtils)
149+
=======
150+
public function loginAction(Request $request, AuthenticationUtils $authenticationUtils)
151+
>>>>>>> 3.4
148152
{
149153
// get the login error if there is one
150-
$error = $authUtils->getLastAuthenticationError();
154+
$error = $authenticationUtils->getLastAuthenticationError();
151155

152156
// last username entered by the user
153-
$lastUsername = $authUtils->getLastUsername();
157+
$lastUsername = $authenticationUtils->getLastUsername();
154158

155159
return $this->render('security/login.html.twig', array(
156160
'last_username' => $lastUsername,
@@ -160,10 +164,16 @@ Great! Next, add the logic to ``login()`` that displays the login form::
160164

161165
.. note::
162166

167+
<<<<<<< HEAD
163168
If you get an error that the ``$authUtils`` argument is missing, it's
164169
probably because the controllers of your application are not defined as
165170
services and tagged with the ``controller.service_arguments`` tag, as done
166171
in the :ref:`default services.yaml configuration <service-container-services-load-example>`.
172+
=======
173+
If you get an error that the ``$authenticationUtils`` argument is missing,
174+
it's probably because you need to activate this new feature in Symfony 3.4.
175+
See this :ref:`controller service argument note <controller-service-arguments-tag>`.
176+
>>>>>>> 3.4
167177

168178
Don't let this controller confuse you. As you'll see in a moment, when the
169179
user submits the form, the security system automatically handles the form

security/json_login_setup.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,12 @@ path:
110110
use Symfony\Component\Routing\RouteCollection;
111111
use Symfony\Component\Routing\Route;
112112
113-
$collection = new RouteCollection();
114-
$collection->add('login', new Route('/login', array(
113+
$routes = new RouteCollection();
114+
$routes->add('login', new Route('/login', array(
115115
'_controller' => 'App\Controller\SecurityController::login',
116116
)));
117117
118-
return $collection;
118+
return $routes;
119119
120120
Don't let this empty controller confuse you. When you submit a ``POST`` request
121121
to the ``/login`` URL with the following JSON document as the body, the security

workflow/usage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ you can get the workflow by injecting the Workflow registry service::
200200
// Update the currentState on the post
201201
try {
202202
$workflow->apply($post, 'to_review');
203-
} catch (LogicException $e) {
203+
} catch (LogicException $exception) {
204204
// ... if the transition is not allowed
205205
}
206206

0 commit comments

Comments
 (0)