Skip to content

Commit c00626c

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: Added doc about Homestead's Symfony integration remove note about memory spool handling on CLI [Cookbook][Serializer] fix wording Document translation_domain setting for choice fields translation_domain doc fix choice_translation_domain doc fix Travis fix Update entity.rst
2 parents d1e3024 + ebe0724 commit c00626c

File tree

11 files changed

+101
-48
lines changed

11 files changed

+101
-48
lines changed

Diff for: book/routing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -1592,7 +1592,7 @@ URL) rather than the ``path()`` function (which generates a relative URL):
15921592
The host that's used when generating an absolute URL is automatically
15931593
detected using the current ``Request`` object. When generating absolute
15941594
URLs from outside the web context (for instance in a console command) this
1595-
doesn't work. See :doc:`/cookbook/console/sending_emails` to learn how to
1595+
doesn't work. See :doc:`/cookbook/console/request_context` to learn how to
15961596
solve this problem.
15971597

15981598
Summary

Diff for: cookbook/console/index.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ Console
88
usage
99
style
1010
command_in_controller
11-
sending_emails
11+
request_context
1212
logging
1313
commands_as_services

Diff for: cookbook/console/sending_emails.rst renamed to cookbook/console/request_context.rst

+2-43
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
.. index::
2-
single: Console; Sending emails
32
single: Console; Generating URLs
43

5-
How to Generate URLs and Send Emails from the Console
6-
=====================================================
4+
How to Generate URLs from the Console
5+
=====================================
76

87
Unfortunately, the command line context does not know about your VirtualHost
98
or domain name. This means that if you generate absolute URLs within a
@@ -81,43 +80,3 @@ from the ``router`` service and override its settings::
8180
// ... your code here
8281
}
8382
}
84-
85-
Using Memory Spooling
86-
---------------------
87-
88-
.. versionadded:: 2.3
89-
When using Symfony 2.3+ and SwiftmailerBundle 2.3.5+, the memory spool is now
90-
handled automatically in the CLI and the code below is not necessary anymore.
91-
92-
Sending emails in a console command works the same way as described in the
93-
:doc:`/cookbook/email/email` cookbook except if memory spooling is used.
94-
95-
When using memory spooling (see the :doc:`/cookbook/email/spool` cookbook for more
96-
information), you must be aware that because of how Symfony handles console
97-
commands, emails are not sent automatically. You must take care of flushing
98-
the queue yourself. Use the following code to send emails inside your
99-
console command::
100-
101-
$message = new \Swift_Message();
102-
103-
// ... prepare the message
104-
105-
$container = $this->getContainer();
106-
$mailer = $container->get('mailer');
107-
108-
$mailer->send($message);
109-
110-
// now manually flush the queue
111-
$spool = $mailer->getTransport()->getSpool();
112-
$transport = $container->get('swiftmailer.transport.real');
113-
114-
$spool->flushQueue($transport);
115-
116-
Another option is to create an environment which is only used by console
117-
commands and uses a different spooling method.
118-
119-
.. note::
120-
121-
Taking care of the spooling is only needed when memory spooling is used.
122-
If you are using file spooling (or no spooling at all), there is no need
123-
to flush the queue manually within the command.

Diff for: cookbook/map.rst.inc

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
* :doc:`/cookbook/console/usage`
4848
* :doc:`/cookbook/console/style`
4949
* :doc:`/cookbook/console/command_in_controller`
50-
* :doc:`/cookbook/console/sending_emails`
50+
* :doc:`/cookbook/console/request_context`
5151
* :doc:`/cookbook/console/logging`
5252
* :doc:`/cookbook/console/commands_as_services`
5353

@@ -265,3 +265,4 @@
265265

266266
* :doc:`/cookbook/workflow/new_project_git`
267267
* :doc:`/cookbook/workflow/new_project_svn`
268+
* :doc:`/cookbook/workflow/homestead`

Diff for: cookbook/serializer.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,8 @@ Enabling the Metadata Cache
178178
---------------------------
179179

180180
.. versionadded:: 2.7
181-
Serializer was introduced in Symfony 2.7.
181+
Serializer metadata and the ability to cache them were introduced in
182+
Symfony 2.7.
182183

183184
Metadata used by the Serializer component such as groups can be cached to
184185
enhance application performance. Any service implementing the ``Doctrine\Common\Cache\Cache``

Diff for: cookbook/workflow/homestead.rst

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
.. index:: Vagrant, Homestead
2+
3+
Using Symfony with Homestead/Vagrant
4+
====================================
5+
6+
In order to develop a Symfony application, you might want to use a virtual
7+
development environment instead of the built-in server or WAMP/LAMP. Homestead_
8+
is an easy-to-use Vagrant_ box to get a virtual environment up and running
9+
quickly.
10+
11+
.. tip::
12+
13+
Due to the amount of filesystem operations in Symfony (e.g. updating cache
14+
files and writing to log files), Symfony can slow down signifcantly. To
15+
improve the speed, consider :ref:`overriding the cache and log directories <override-cache-dir>`
16+
to a location outside the NFS share (for instance, by using
17+
:phpfunction:`sys_get_temp_dir`). You can read `this blog post`_ for more
18+
tips to speed up Symfony on Vagrant.
19+
20+
Install Vagrant and Homestead
21+
-----------------------------
22+
23+
Before you can use Homestead, you need to install and configure Vagrant and
24+
Homestead as explained in `the Homestead documentation`_.
25+
26+
Setting Up a Symfony Application
27+
--------------------------------
28+
29+
Imagine you've installed your Symfony application in
30+
``~/projects/symfony_demo`` on your local system. You first need Homestead to
31+
sync your files in this project. Execute ``homestead edit`` to edit the
32+
Homestead configuration and configure the ``~/projects`` directory:
33+
34+
.. code-block:: yaml
35+
36+
# ...
37+
folders:
38+
- map: ~/projects
39+
to: /home/vagrant/projects
40+
41+
The ``projects/`` directory on your PC is now accessible at
42+
``/home/vagrant/projects`` in the Homestead environment.
43+
44+
After you've done this, configure the Symfony application in the Homestead
45+
configuration:
46+
47+
.. code-block:: yaml
48+
49+
# ...
50+
sites:
51+
- map: symfony-demo.dev
52+
to: /home/vagrant/projects/symfony_demo/web
53+
type: symfony
54+
55+
The ``type`` option tells Homestead to use the Symfony nginx configuration.
56+
57+
At last, edit the hosts file on your local machine to map ``symfony-demo.dev``
58+
to ``192.168.10.10`` (which is the IP used by Homestead)::
59+
60+
# /etc/hosts (unix) or C:\Windows\System32\drivers\etc\hosts (Windows)
61+
192.168.10.10 symfony-demo.dev
62+
63+
Now, navigate to ``http://symfony-demo.dev`` in your web browser and enjoy
64+
developing your Symfony application!
65+
66+
.. seealso::
67+
68+
To learn more features of Homestead, including Blackfire Profiler
69+
integration, automatic creation of MySQL databases and more, read the
70+
`Daily Usage`_ section of the Homestead documentation.
71+
72+
.. _Homestead: http://laravel.com/docs/homestead
73+
.. _Vagrant: https://www.vagrantup.com/
74+
.. _the Homestead documentation: http://laravel.com/docs/homestead#installation-and-setup
75+
.. _Daily Usage: http://laravel.com/docs/5.1/homestead#daily-usage
76+
.. _this blog post: http://www.whitewashing.de/2013/08/19/speedup_symfony2_on_vagrant_boxes.html

Diff for: cookbook/workflow/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Workflow
66

77
new_project_git
88
new_project_svn
9+
homestead

Diff for: redirection_map

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/book/stable_api /contributing/code/bc
22
/book/internals /reference/events
3+
/cookbook/console/sending_emails /cookbook/console/request_context
34
/cookbook/deployment-tools /cookbook/deployment/tools
45
/cookbook/doctrine/migrations /bundles/DoctrineFixturesBundle/index
56
/cookbook/doctrine/doctrine_fixtures /bundles/DoctrineFixturesBundle/index

Diff for: reference/forms/types/choice.rst

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
1717
| | - `choice_loader`_ |
1818
| | - `choice_label`_ |
1919
| | - `choice_attr`_ |
20+
| | - `choice_translation_domain`_ |
2021
| | - `placeholder`_ |
2122
| | - `expanded`_ |
2223
| | - `multiple`_ |
@@ -41,6 +42,7 @@ To use this field, you must specify *either* ``choices`` or ``choice_loader`` op
4142
| | - `mapped`_ |
4243
| | - `read_only`_ (deprecated as of 2.8) |
4344
| | - `required`_ |
45+
| | - `translation_domain`_ |
4446
+-------------+------------------------------------------------------------------------------+
4547
| Parent type | :doc:`FormType </reference/forms/types/form>` |
4648
+-------------+------------------------------------------------------------------------------+
@@ -361,6 +363,8 @@ These options inherit from the :doc:`FormType </reference/forms/types/form>`:
361363

362364
.. include:: /reference/forms/types/options/required.rst.inc
363365

366+
.. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc
367+
364368
Field Variables
365369
---------------
366370

Diff for: reference/forms/types/entity.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ objects from the database.
2424
| options | |
2525
| | - `placeholder`_ |
2626
| | - `choice_translation_domain`_ |
27+
| | - `translation_domain`_ |
2728
| | - `expanded`_ |
2829
| | - `multiple`_ |
2930
| | - `preferred_choices`_ |
@@ -195,7 +196,6 @@ em
195196
If specified, this entity manager will be used to load the choices
196197
instead of the ``default`` entity manager.
197198

198-
199199
Overridden Options
200200
------------------
201201

@@ -217,6 +217,8 @@ These options inherit from the :doc:`ChoiceType </reference/forms/types/choice>`
217217

218218
.. include:: /reference/forms/types/options/choice_translation_domain.rst.inc
219219

220+
.. include:: /reference/forms/types/options/choice_type_translation_domain.rst.inc
221+
220222
.. include:: /reference/forms/types/options/expanded.rst.inc
221223

222224
.. include:: /reference/forms/types/options/multiple.rst.inc
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
translation_domain
2+
~~~~~~~~~~~~~~~~~~
3+
4+
**type**: ``string`` **default**: ``messages``
5+
6+
In case `choice_translation_domain`_ is set to ``true`` or ``null``, this
7+
configures the exact translation domain that will be used for any labels or
8+
options that are rendered for this field

0 commit comments

Comments
 (0)