From 873706cccac3d6e8808ad13d50aa14c37e2850bc Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 18 Mar 2014 14:18:31 -0500 Subject: [PATCH 01/11] Moved the section about generating absolute URLs down This is so we have the controller/PHP version and template version in the same spot. See #3573 I also made a few other tweaks, including using generateUrl (like we did earlier) to generate the absolute URL, not going through the router service directly. --- book/routing.rst | 48 +++++++++++++++++++++++------------------------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/book/routing.rst b/book/routing.rst index 0a72665bd81..799a1c42bc5 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1192,29 +1192,6 @@ In an upcoming section, you'll learn how to generate URLs from inside templates. For more information, see the documentation for that bundle. -.. index:: - single: Routing; Absolute URLs - -Generating Absolute URLs -~~~~~~~~~~~~~~~~~~~~~~~~ - -By default, the router will generate relative URLs (e.g. ``/blog``). To generate -an absolute URL, simply pass ``true`` to the third argument of the ``generate()`` -method:: - - $this->get('router')->generate('blog_show', array('slug' => 'my-blog-post'), true); - // http://www.example.com/blog/my-blog-post - -.. note:: - - The host that's used when generating an absolute URL is the host of - the current ``Request`` object. This is detected automatically based - on server information supplied by PHP. When generating absolute URLs for - scripts run from the command line, you'll need to manually set the desired - host on the ``RequestContext`` object:: - - $this->get('router')->getContext()->setHost('www.example.com'); - .. index:: single: Routing; Generating URLs in a template @@ -1227,7 +1204,7 @@ But if you pass extra ones, they will be added to the URI as a query string:: $this->get('router')->generate('blog', array('page' => 2, 'category' => 'Symfony')); // /blog/2?category=Symfony -Generating URLs from a template +Generating URLs from a Template ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The most common place to generate a URL is from within a template when linking @@ -1250,7 +1227,20 @@ a template helper function: Read this blog post. -Absolute URLs can also be generated. +.. index:: + single: Routing; Absolute URLs + +Generating Absolute URLs +~~~~~~~~~~~~~~~~~~~~~~~~ + +By default, the router will generate relative URLs (e.g. ``/blog``). From +a controller, simply pass ``true`` to the third argument of the ``generateUrl()`` +method:: + + $this->getgenerateUrl('blog_show', array('slug' => 'my-blog-post'), true); + // http://www.example.com/blog/my-blog-post + +From a template, it looks like this: .. configuration-block:: @@ -1268,6 +1258,14 @@ Absolute URLs can also be generated. Read this blog post. +.. note:: + + The host that's used when generating an absolute URL is the host of + the current ``Request`` object. This is detected automatically. But if + you generate absolute URLs for scripts run from the command line, this + won't work. But don't worry! Just see :doc:`/cookbook/console/sending_emails` + for details. + Summary ------- From 007a54fa90bca25a1ced3d725b1e68880f6da8c3 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 18 Mar 2014 21:45:17 -0500 Subject: [PATCH 02/11] Fixing typo thanks to @xabbuh --- book/routing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/routing.rst b/book/routing.rst index 799a1c42bc5..1039f673d63 100644 --- a/book/routing.rst +++ b/book/routing.rst @@ -1237,7 +1237,7 @@ By default, the router will generate relative URLs (e.g. ``/blog``). From a controller, simply pass ``true`` to the third argument of the ``generateUrl()`` method:: - $this->getgenerateUrl('blog_show', array('slug' => 'my-blog-post'), true); + $this->generateUrl('blog_show', array('slug' => 'my-blog-post'), true); // http://www.example.com/blog/my-blog-post From a template, it looks like this: From a94518d75c3b38cfe92fc173de2e8f7c9d08e311 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 19 Mar 2014 09:02:32 +0100 Subject: [PATCH 03/11] fix the referenced documents names --- cookbook/bundles/extension.rst | 2 +- cookbook/routing/service_container_parameters.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/bundles/extension.rst b/cookbook/bundles/extension.rst index 7d2c05dabf0..51d158b3ccb 100644 --- a/cookbook/bundles/extension.rst +++ b/cookbook/bundles/extension.rst @@ -92,7 +92,7 @@ The second method has several specific advantages: .. seealso:: For parameter handling within a Dependency Injection class see - :doc:``. + :doc:`/cookbook/configuration/using_parameters_in_dic`. .. index:: single: Bundle; Extension diff --git a/cookbook/routing/service_container_parameters.rst b/cookbook/routing/service_container_parameters.rst index 795a45d32e4..295bb366be4 100644 --- a/cookbook/routing/service_container_parameters.rst +++ b/cookbook/routing/service_container_parameters.rst @@ -128,4 +128,4 @@ path): .. seealso:: For parameter handling within a Dependency Injection class see - :doc:``. + :doc:`/cookbook/configuration/using_parameters_in_dic`. From 911cc705432190dba4a1f9f36f9a8e51678596df Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Wed, 26 Feb 2014 17:27:44 +0100 Subject: [PATCH 04/11] add an introductory table containing all options of the basic form type --- reference/forms/types/form.rst | 41 +++++++++++++++++++++++++++++++--- 1 file changed, 38 insertions(+), 3 deletions(-) diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index e327adb318d..8e1d76eb58a 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -4,10 +4,45 @@ form Field Type =============== -See :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType`. - The ``form`` type predefines a couple of options that are then available -on all fields. +on all types for which ``form`` is the parent type. + ++---------+--------------------------------------------------------------------+ +| Options | - `compound`_ | +| | - `data`_ | +| | - `data_class`_ | +| | - `empty_data`_ | +| | - `required`_ | +| | - `label`_ | +| | - `label_attr`_ | +| | - `constraints`_ | +| | - `cascade_validation`_ | +| | - `read_only`_ | +| | - `disabled`_ | +| | - `trim`_ | +| | - `mapped`_ | +| | - `property_path`_ | +| | - `attr`_ | +| | - `translation_domain`_ | +| | - `block_name`_ | +| | - `max_length`_ | +| | - `by_reference`_ | +| | - `error_bubbling`_ | +| | - `inherit_data`_ | +| | - `error_mapping`_ | +| | - `invalid_message`_ | +| | - `invalid_message_parameters`_ | +| | - `extra_fields_message`_ | +| | - `post_max_size_message`_ | +| | - `pattern`_ | ++---------+--------------------------------------------------------------------+ +| Parent | none | ++---------+--------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType` | ++---------+--------------------------------------------------------------------+ + +Options +------- .. include:: /reference/forms/types/options/data.rst.inc From 2ca0306a96f5f0ced0551476fe78cb395d0547a4 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 8 Mar 2014 10:35:22 +0100 Subject: [PATCH 05/11] document the options inherited from the BaseType class --- reference/forms/types/button.rst | 14 +++-- reference/forms/types/form.rst | 100 ++++++++++++++++++------------- 2 files changed, 67 insertions(+), 47 deletions(-) diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index dc723fd1630..a58fb5c3333 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -12,8 +12,8 @@ A simple, non-responsive button. +----------------------+----------------------------------------------------------------------+ | Rendered as | ``button`` tag | +----------------------+----------------------------------------------------------------------+ -| Options | - `attr`_ | -| | - `disabled`_ | +| Inherited | - `attr`_ | +| options | - `disabled`_ | | | - `label`_ | | | - `translation_domain`_ | +----------------------+----------------------------------------------------------------------+ @@ -24,8 +24,14 @@ A simple, non-responsive button. | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` | +----------------------+----------------------------------------------------------------------+ -Options -------- +Inherited options +----------------- + +The following options are defined in the +:class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType` class. +The ``BaseType`` class is the parent class for both the ``button`` type and +the :doc:`form type `, but it is not part of +the form type tree (i.e. it can not be used as a form type on its own). .. include:: /reference/forms/types/options/button_attr.rst.inc diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 8e1d76eb58a..9481e752cd5 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -7,39 +7,40 @@ form Field Type The ``form`` type predefines a couple of options that are then available on all types for which ``form`` is the parent type. -+---------+--------------------------------------------------------------------+ -| Options | - `compound`_ | -| | - `data`_ | -| | - `data_class`_ | -| | - `empty_data`_ | -| | - `required`_ | -| | - `label`_ | -| | - `label_attr`_ | -| | - `constraints`_ | -| | - `cascade_validation`_ | -| | - `read_only`_ | -| | - `disabled`_ | -| | - `trim`_ | -| | - `mapped`_ | -| | - `property_path`_ | -| | - `attr`_ | -| | - `translation_domain`_ | -| | - `block_name`_ | -| | - `max_length`_ | -| | - `by_reference`_ | -| | - `error_bubbling`_ | -| | - `inherit_data`_ | -| | - `error_mapping`_ | -| | - `invalid_message`_ | -| | - `invalid_message_parameters`_ | -| | - `extra_fields_message`_ | -| | - `post_max_size_message`_ | -| | - `pattern`_ | -+---------+--------------------------------------------------------------------+ -| Parent | none | -+---------+--------------------------------------------------------------------+ -| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType` | -+---------+--------------------------------------------------------------------+ ++-----------+--------------------------------------------------------------------+ +| Options | - `compound`_ | +| | - `data`_ | +| | - `data_class`_ | +| | - `empty_data`_ | +| | - `required`_ | +| | - `label_attr`_ | +| | - `constraints`_ | +| | - `cascade_validation`_ | +| | - `read_only`_ | +| | - `trim`_ | +| | - `mapped`_ | +| | - `property_path`_ | +| | - `max_length`_ | +| | - `by_reference`_ | +| | - `error_bubbling`_ | +| | - `inherit_data`_ | +| | - `error_mapping`_ | +| | - `invalid_message`_ | +| | - `invalid_message_parameters`_ | +| | - `extra_fields_message`_ | +| | - `post_max_size_message`_ | +| | - `pattern`_ | ++-----------+--------------------------------------------------------------------+ +| Inherited | - `block_name`_ | +| options | - `disabled`_ | +| | - `label`_ | +| | - `attr`_ | +| | - `translation_domain`_ | ++-----------+--------------------------------------------------------------------+ +| Parent | none | ++-----------+--------------------------------------------------------------------+ +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\FormType` | ++-----------+--------------------------------------------------------------------+ Options ------- @@ -60,8 +61,6 @@ Options .. include:: /reference/forms/types/options/required.rst.inc -.. include:: /reference/forms/types/options/label.rst.inc - .. include:: /reference/forms/types/options/label_attr.rst.inc .. include:: /reference/forms/types/options/constraints.rst.inc @@ -70,20 +69,12 @@ Options .. include:: /reference/forms/types/options/read_only.rst.inc -.. include:: /reference/forms/types/options/disabled.rst.inc - .. include:: /reference/forms/types/options/trim.rst.inc .. include:: /reference/forms/types/options/mapped.rst.inc .. include:: /reference/forms/types/options/property_path.rst.inc -.. include:: /reference/forms/types/options/attr.rst.inc - -.. include:: /reference/forms/types/options/translation_domain.rst.inc - -.. include:: /reference/forms/types/options/block_name.rst.inc - .. _reference-form-option-max_length: .. include:: /reference/forms/types/options/max_length.rst.inc @@ -107,3 +98,26 @@ Options .. _reference-form-option-pattern: .. include:: /reference/forms/types/options/pattern.rst.inc + +.. include:: /reference/forms/types/options/action.rst.inc + +.. include:: /reference/forms/types/options/method.rst.inc + +Inherited options +----------------- + +The following options are defined in the +:class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\BaseType` class. +The ``BaseType`` class is the parent class for both the ``form`` type and +the :doc:`button type `, but it is not part +of the form type tree (i.e. it can not be used as a form type on its own). + +.. include:: /reference/forms/types/options/block_name.rst.inc + +.. include:: /reference/forms/types/options/disabled.rst.inc + +.. include:: /reference/forms/types/options/label.rst.inc + +.. include:: /reference/forms/types/options/attr.rst.inc + +.. include:: /reference/forms/types/options/translation_domain.rst.inc From 58170fe71fcf76ad59047caf629357d61e41a6c3 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 8 Mar 2014 11:38:57 +0100 Subject: [PATCH 06/11] document the auto_initialize option for the form type, refs #3410 --- reference/forms/types/form.rst | 3 +++ reference/forms/types/options/auto_initialize.rst.inc | 8 ++++++++ 2 files changed, 11 insertions(+) create mode 100644 reference/forms/types/options/auto_initialize.rst.inc diff --git a/reference/forms/types/form.rst b/reference/forms/types/form.rst index 9481e752cd5..38416d12aa9 100644 --- a/reference/forms/types/form.rst +++ b/reference/forms/types/form.rst @@ -36,6 +36,7 @@ on all types for which ``form`` is the parent type. | | - `label`_ | | | - `attr`_ | | | - `translation_domain`_ | +| | - `auto_initialize`_ | +-----------+--------------------------------------------------------------------+ | Parent | none | +-----------+--------------------------------------------------------------------+ @@ -121,3 +122,5 @@ of the form type tree (i.e. it can not be used as a form type on its own). .. include:: /reference/forms/types/options/attr.rst.inc .. include:: /reference/forms/types/options/translation_domain.rst.inc + +.. include:: /reference/forms/types/options/auto_initialize.rst.inc diff --git a/reference/forms/types/options/auto_initialize.rst.inc b/reference/forms/types/options/auto_initialize.rst.inc new file mode 100644 index 00000000000..4accfd816ba --- /dev/null +++ b/reference/forms/types/options/auto_initialize.rst.inc @@ -0,0 +1,8 @@ +auto_initialize +~~~~~~~~~~~~~~~ + +**type**: ``boolean`` **default**: ``true`` + +An internal option: sets whether the form should be initialized automatically. +For all fields, this option should only be ``true`` for root forms. You won't +need to change this option and probably won't need to worry about it. From b3ca94c7833390f7128c692992ed6ed413dd9cb2 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sun, 9 Mar 2014 22:53:17 +0100 Subject: [PATCH 07/11] removed the description of the auto_initialize option from the button type reference docs --- reference/forms/types/button.rst | 7 ------- .../forms/types/options/button_auto_initialize.rst.inc | 9 --------- 2 files changed, 16 deletions(-) delete mode 100644 reference/forms/types/options/button_auto_initialize.rst.inc diff --git a/reference/forms/types/button.rst b/reference/forms/types/button.rst index a58fb5c3333..a0bf11c5480 100644 --- a/reference/forms/types/button.rst +++ b/reference/forms/types/button.rst @@ -17,8 +17,6 @@ A simple, non-responsive button. | | - `label`_ | | | - `translation_domain`_ | +----------------------+----------------------------------------------------------------------+ -| Overridden options | - `auto_initialize`_ | -+----------------------+----------------------------------------------------------------------+ | Parent type | none | +----------------------+----------------------------------------------------------------------+ | Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ButtonType` | @@ -40,8 +38,3 @@ the form type tree (i.e. it can not be used as a form type on its own). .. include:: /reference/forms/types/options/button_label.rst.inc .. include:: /reference/forms/types/options/button_translation_domain.rst.inc - -Overridden Options ------------------- - -.. include:: /reference/forms/types/options/button_auto_initialize.rst.inc diff --git a/reference/forms/types/options/button_auto_initialize.rst.inc b/reference/forms/types/options/button_auto_initialize.rst.inc deleted file mode 100644 index d34de3cfc3d..00000000000 --- a/reference/forms/types/options/button_auto_initialize.rst.inc +++ /dev/null @@ -1,9 +0,0 @@ -auto_initialize -~~~~~~~~~~~~~~~ - -**type**: ``boolean`` **default**: ``false`` - -An internal option: sets whether the form should be initialized automatically. -For all fields, this option should only be ``true`` for root forms and since -a button can't be an entire form on its own, this is set to ``false``. You -won't need to change this option and probably won't need to worry about it. From 08036b6b8102d783ceef3efaf73cdf20a769bb4b Mon Sep 17 00:00:00 2001 From: Tony Cosentino Date: Mon, 10 Feb 2014 18:00:34 +0100 Subject: [PATCH 08/11] Add another tip to setup permissions in dev environnement. | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | all | Fixed tickets | n/a --- book/installation.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/book/installation.rst b/book/installation.rst index 06fceb62609..5c28db2edfb 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -269,6 +269,14 @@ If there are any issues, correct them now before moving on. Note that using the ACL is recommended when you have access to them on your server because changing the umask is not thread-safe. + + **4. Use the same user for CLI and HTTP** + + It is a common practice to use the same unix user for CLI and HTTP. It avoids + typing commands when setting up new projects. This is done by editing your + Apache configuration file ``httpd.conf`` and update the user and group values + from ``www-data`` to your CLI user. Obviously, this is only recommended in dev + environnement. When everything is fine, click on "Go to the Welcome page" to request your first "real" Symfony2 webpage: From 344a43f864bda4784719a7c7defda2544f8c2544 Mon Sep 17 00:00:00 2001 From: Tony Cosentino Date: Mon, 10 Feb 2014 18:17:05 +0100 Subject: [PATCH 09/11] Update installation.rst Fixed typo --- book/installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/book/installation.rst b/book/installation.rst index 5c28db2edfb..7a59a8d1f91 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -276,7 +276,7 @@ If there are any issues, correct them now before moving on. typing commands when setting up new projects. This is done by editing your Apache configuration file ``httpd.conf`` and update the user and group values from ``www-data`` to your CLI user. Obviously, this is only recommended in dev - environnement. + environment. When everything is fine, click on "Go to the Welcome page" to request your first "real" Symfony2 webpage: From f5d9e3668618079c22f060834eeba4d802fa1411 Mon Sep 17 00:00:00 2001 From: Tony Cosentino Date: Tue, 18 Feb 2014 21:41:30 +0100 Subject: [PATCH 10/11] Updated tip with latest comments --- book/installation.rst | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/book/installation.rst b/book/installation.rst index 7a59a8d1f91..c7bcf603197 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -270,13 +270,15 @@ If there are any issues, correct them now before moving on. Note that using the ACL is recommended when you have access to them on your server because changing the umask is not thread-safe. - **4. Use the same user for CLI and HTTP** - - It is a common practice to use the same unix user for CLI and HTTP. It avoids - typing commands when setting up new projects. This is done by editing your - Apache configuration file ``httpd.conf`` and update the user and group values - from ``www-data`` to your CLI user. Obviously, this is only recommended in dev - environment. + **4. Use the same user for the CLI and the web server** + + In development environments, it is a common practice to use the same unix + user for the CLI and the web server because it avoids any of these permissions + issues when setting up new projects. This is done by editing your Apache + configuration file ``httpd.conf`` and updating the User and Group values + from ``www-data`` to your CLI user. Obviously, this is only recommended in + development environment as you do not want to give Apache full control over + your whole production system. When everything is fine, click on "Go to the Welcome page" to request your first "real" Symfony2 webpage: From 75b2387d473cb8ceb6ca4b1c09a15a9de2367f67 Mon Sep 17 00:00:00 2001 From: Tony Cosentino Date: Wed, 19 Mar 2014 12:07:28 +0100 Subject: [PATCH 11/11] Rephrase --- book/installation.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/book/installation.rst b/book/installation.rst index c7bcf603197..e219e9640c9 100644 --- a/book/installation.rst +++ b/book/installation.rst @@ -274,11 +274,10 @@ If there are any issues, correct them now before moving on. In development environments, it is a common practice to use the same unix user for the CLI and the web server because it avoids any of these permissions - issues when setting up new projects. This is done by editing your Apache - configuration file ``httpd.conf`` and updating the User and Group values - from ``www-data`` to your CLI user. Obviously, this is only recommended in - development environment as you do not want to give Apache full control over - your whole production system. + issues when setting up new projects. This can be done by editing your web server + configuration (e.g. commonly httpd.conf or apache2.conf for Apache) and setting + its user to be the same as your CLI user (e.g. for Apache, update the User + and Group values). When everything is fine, click on "Go to the Welcome page" to request your first "real" Symfony2 webpage: