Skip to content

Commit 5d7fa56

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Reword a code comment uploading example: explaining the need for md5 soap_web_service: code style in examples Updated the main performance article to make it more actionable Fix typos Added a note about using slashes and the special _format param
2 parents 811c4be + eb637f0 commit 5d7fa56

File tree

5 files changed

+180
-160
lines changed

5 files changed

+180
-160
lines changed

controller/soap_web_service.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ In this case, the SOAP service will allow the client to call a method called
4040
{
4141

4242
$message = new \Swift_Message('Hello Service')
43-
->setTo('me@example.com')
44-
->setBody($name . ' says hi!');
43+
->setTo('me@example.com')
44+
->setBody($name.' says hi!');
4545

4646
$this->mailer->send($message);
4747

controller/upload_file.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,7 @@ Finally, you need to update the code of the controller that handles the form::
132132
/** @var Symfony\Component\HttpFoundation\File\UploadedFile $file */
133133
$file = $product->getBrochure();
134134

135-
// Generate a unique name for the file before saving it
136-
$fileName = md5(uniqid()).'.'.$file->guessExtension();
135+
$fileName = $this->generateUniqueFileName().'.'.$file->guessExtension();
137136

138137
// Move the file to the directory where brochures are stored
139138
$file->move(
@@ -154,6 +153,16 @@ Finally, you need to update the code of the controller that handles the form::
154153
'form' => $form->createView(),
155154
));
156155
}
156+
157+
/**
158+
* @return string
159+
*/
160+
private function generateUniqueFileName()
161+
{
162+
// md5() reduces the similarity of the file names generated by
163+
// uniqid(), which is based on timestamps
164+
return md5(uniqid());
165+
}
157166
}
158167

159168
Now, create the ``brochures_directory`` parameter that was used in the

introduction/from_flat_php_to_symfony2.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ nice way to group related pages. The controller functions are also sometimes cal
581581
The two controllers (or actions) are still lightweight. Each uses the
582582
:doc:`Doctrine ORM library </doctrine>` to retrieve objects from the
583583
database and the Templating component to render a template and return a
584-
``Response`` object. The list ``list.php`` template is now quite a bit simpler:
584+
``Response`` object. The ``list.php`` template is now quite a bit simpler:
585585

586586
.. code-block:: html+php
587587

@@ -624,7 +624,7 @@ The ``layout.php`` file is nearly identical:
624624

625625
.. note::
626626

627-
The show ``show.php`` template is left as an exercise: updating it should be
627+
The ``show.php`` template is left as an exercise: updating it should be
628628
really similar to updating the ``list.php`` template.
629629

630630
When Symfony's engine (called the Kernel) boots up, it needs a map so
@@ -674,10 +674,10 @@ It's a beautiful thing.
674674
Better Templates
675675
~~~~~~~~~~~~~~~~
676676

677-
If you choose to use it, Symfony comes standard with a templating engine
677+
If you choose to use it, Symfony comes with a templating engine
678678
called `Twig`_ that makes templates faster to write and easier to read.
679-
It means that the sample application could contain even less code! Take,
680-
for example, rewriting ``list.html.php`` template in Twig would look like
679+
It means that the sample application could contain even less code! For
680+
example, rewriting the ``list.html.php`` template in Twig would look like
681681
this:
682682

683683
.. code-block:: html+twig
@@ -700,7 +700,7 @@ this:
700700
</ul>
701701
{% endblock %}
702702

703-
And rewriting ``layout.html.php`` template in Twig would look like this:
703+
And rewriting the ``layout.html.php`` template in Twig would look like this:
704704

705705
.. code-block:: html+twig
706706

@@ -722,9 +722,9 @@ be discussed. For more information, see the :doc:`templating article </templatin
722722
Where Symfony Delivers
723723
----------------------
724724

725-
In the rest of documentation articles, you'll learn more about how each piece of
726-
Symfony works and how you can organize your project. For now, celebrate at how
727-
migrating the blog from flat PHP to Symfony has improved life:
725+
In the rest of the documentation articles, you'll learn more about how each piece of
726+
Symfony works and how you can organize your project. For now, celebrate how
727+
migrating the blog from flat PHP to Symfony has improved your life:
728728

729729
* Your application now has **clear and consistently organized code** (though
730730
Symfony doesn't force you into this). This promotes **reusability** and

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy