Permalink
Browse files

minor #3595 Collection of fixes and improvements (bicpi)

This PR was merged into the 2.3 branch.

Discussion
----------

Collection of fixes and improvements

| Q             | A
| ------------- | ---
| Doc fix?      | yes
| New docs?     | no
| Applies to    | all
| Fixed tickets | -

This PR fixes all kind of typos, formatting and code issues.
It also adds some missing code blocks and notes or improvements.

Thanks for your review and please let me know if you see something wrong.

Commits
-------

56e475c Fixes after review
8d4f444 Fixes of all kind
  • Loading branch information...
weaverryan committed Mar 7, 2014
2 parents 2ed0943 + 56e475c commit 04cf9f8699d322497b5979f1e38547da509f70f4
Showing with 108 additions and 68 deletions.
  1. +2 −2 book/controller.rst
  2. +6 −6 book/forms.rst
  3. +9 −3 book/security.rst
  4. +3 −5 book/service_container.rst
  5. +4 −4 book/templating.rst
  6. +5 −4 book/translation.rst
  7. +2 −2 book/validation.rst
  8. +1 −1 components/console/helpers/dialoghelper.rst
  9. +1 −1 components/console/helpers/tablehelper.rst
  10. +6 −6 components/console/introduction.rst
  11. +13 −1 components/dependency_injection/advanced.rst
  12. +1 −1 components/dependency_injection/definitions.rst
  13. +2 −2 components/dependency_injection/introduction.rst
  14. +1 −1 components/dependency_injection/parentservices.rst
  15. +12 −0 components/dependency_injection/tags.rst
  16. +2 −2 components/http_foundation/introduction.rst
  17. +1 −1 components/property_access/introduction.rst
  18. +5 −5 components/routing/introduction.rst
  19. +1 −1 components/translation/usage.rst
  20. +1 −1 cookbook/bundles/inheritance.rst
  21. +1 −1 cookbook/bundles/override.rst
  22. +2 −2 cookbook/bundles/prepend_extension.rst
  23. +1 −1 cookbook/security/entity_provider.rst
  24. +1 −1 reference/constraints/Image.rst
  25. +4 −2 reference/constraints/Valid.rst
  26. +2 −2 reference/forms/types/collection.rst
  27. +1 −1 reference/forms/types/date.rst
  28. +1 −1 reference/forms/types/entity.rst
  29. +1 −1 reference/forms/types/options/checkbox_compound.rst.inc
  30. +2 −2 reference/forms/types/options/date_widget.rst.inc
  31. +1 −1 reference/forms/types/options/empty_data.rst.inc
  32. +11 −2 reference/forms/types/options/label.rst.inc
  33. +1 −1 reference/forms/types/options/label_attr.rst.inc
  34. +1 −1 reference/forms/types/textarea.rst
View
@@ -470,7 +470,7 @@ object that's returned from that controller::
return $response;
}
Notice that the `forward()` method uses the same string representation of
Notice that the ``forward()`` method uses the same string representation of
the controller used in the routing configuration. In this case, the target
controller class will be ``HelloController`` inside some ``AcmeHelloBundle``.
The array passed to the method becomes the arguments on the resulting controller.
@@ -786,7 +786,7 @@ The Request Object
Besides the values of the routing placeholders, the controller also has access
to the ``Request`` object. The framework injects the ``Request`` object in the
controller if a variable is type-hinted with
`Symfony\Component\HttpFoundation\Request`::
:class:`Symfony\\Component\\HttpFoundation\\Request`::
use Symfony\Component\HttpFoundation\Request;
View
@@ -495,7 +495,7 @@ these cases you can set the ``validation_groups`` option to ``false``::
Note that when you do that, the form will still run basic integrity checks,
for example whether an uploaded file was too large or whether non-existing
fields were submitted. If you want to suppress validation, you can use the
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`
:ref:`POST_SUBMIT event <cookbook-dynamic-form-modification-suppressing-form-validation>`.
.. index::
single: Forms; Validation groups based on submitted data
@@ -1811,7 +1811,7 @@ an array.
$this->get('request')->request->get('name');
Be advised, however, that in most cases using the getData() method is
Be advised, however, that in most cases using the ``getData()`` method is
a better choice, since it returns the data (usually an object) after
it's been transformed by the form framework.
@@ -1858,7 +1858,7 @@ but here's a short example:
.. tip::
If you are using Validation Groups, you need to either reference the
If you are using validation groups, you need to either reference the
``Default`` group when creating the form, or set the correct group on
the constraint you are adding.
@@ -1896,7 +1896,7 @@ Learn more from the Cookbook
.. _`Symfony2 Form component`: https://github.com/symfony/Form
.. _`DateTime`: http://php.net/manual/en/class.datetime.php
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bridge/Twig
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/2.3/src/Symfony/Bridge/Twig
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.3/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
.. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery
.. _`view on GitHub`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
.. _`view on GitHub`: https://github.com/symfony/symfony/tree/2.3/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
View
@@ -51,7 +51,9 @@ authentication (i.e. the old-school username/password box):
realm: "Secured Demo Area"
access_control:
- { path: ^/admin, roles: ROLE_ADMIN }
- { path: ^/admin/, roles: ROLE_ADMIN }
# Include the following line to also secure the /admin path itself
# - { path: ^/admin$, roles: ROLE_ADMIN }
providers:
in_memory:
@@ -79,7 +81,9 @@ authentication (i.e. the old-school username/password box):
</firewall>
<access-control>
<rule path="^/admin" role="ROLE_ADMIN" />
<rule path="^/admin/" role="ROLE_ADMIN" />
<!-- Include the following line to also secure the /admin path itself -->
<!-- <rule path="^/admin$" role="ROLE_ADMIN" /> -->
</access-control>
<provider name="in_memory">
@@ -108,7 +112,9 @@ authentication (i.e. the old-school username/password box):
),
),
'access_control' => array(
array('path' => '^/admin', 'role' => 'ROLE_ADMIN'),
array('path' => '^/admin/', 'role' => 'ROLE_ADMIN'),
// Include the following line to also secure the /admin path itself
// array('path' => '^/admin$', 'role' => 'ROLE_ADMIN'),
),
'providers' => array(
'in_memory' => array(
@@ -980,12 +980,10 @@ with ``twig.extension`` and automatically registers them as extensions.
Tags, then, are a way to tell Symfony2 or other third-party bundles that
your service should be registered or used in some special way by the bundle.
The following is a list of tags available with the core Symfony2 bundles.
Each of these has a different effect on your service and many tags require
additional arguments (beyond just the ``name`` parameter).
For a list of all the tags available in the core Symfony Framework, check
out :doc:`/reference/dic_tags`.
out :doc:`/reference/dic_tags`. Each of these has a different effect on your
service and many tags require additional arguments (beyond just the ``name``
parameter).
Debugging Services
------------------
View
@@ -1039,14 +1039,14 @@ stylesheets and JavaScripts that you'll need throughout your site:
{# ... #}
{% block stylesheets %}
<link href="{{ asset('/css/main.css') }}" rel="stylesheet" />
<link href="{{ asset('css/main.css') }}" rel="stylesheet" />
{% endblock %}
</head>
<body>
{# ... #}
{% block javascripts %}
<script src="{{ asset('/js/main.js') }}"></script>
<script src="{{ asset('js/main.js') }}"></script>
{% endblock %}
</body>
</html>
@@ -1064,7 +1064,7 @@ page. From inside that contact page's template, do the following:
{% block stylesheets %}
{{ parent() }}
<link href="{{ asset('/css/contact.css') }}" rel="stylesheet" />
<link href="{{ asset('css/contact.css') }}" rel="stylesheet" />
{% endblock %}
{# ... #}
@@ -1329,7 +1329,7 @@ covered:
{% endfor %}
{% endblock %}
Notice that this template extends the section template -(``AcmeBlogBundle::layout.html.twig``)
Notice that this template extends the section template (``AcmeBlogBundle::layout.html.twig``)
which in-turn extends the base application layout (``::base.html.twig``).
This is the common three-level inheritance model.
View
@@ -554,8 +554,8 @@ use somewhere in your application::
}
Add constraints though any of the supported methods. Set the message option to the
translation source text. For example, to guarantee that the $name property is not
empty, add the following:
translation source text. For example, to guarantee that the ``$name`` property is
not empty, add the following:
.. configuration-block::
@@ -654,8 +654,8 @@ Translating Database Content
----------------------------
The translation of database content should be handled by Doctrine through
the `Translatable Extension`_. For more information, see the documentation
for that library.
the `Translatable Extension`_ or the `Translatable Bahavior`_ (PHP 5.4+).
For more information, see the documentation for thes libraries.
Summary
-------
@@ -680,3 +680,4 @@ steps:
.. _`ISO 3166-1 alpha-2`: http://en.wikipedia.org/wiki/ISO_3166-1#Current_codes
.. _`ISO 639-1`: http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
.. _`Translatable Extension`: https://github.com/l3pp4rd/DoctrineExtensions
.. _`Translatable Bahavior`: https://github.com/KnpLabs/DoctrineBehaviors
View
@@ -985,9 +985,9 @@ entity and a new constraint group called ``Premium``:
Acme\DemoBundle\Entity\User:
properties:
name:
- NotBlank
- NotBlank: ~
creditCard:
- CardScheme
- CardScheme:
schemes: [VISA]
groups: [Premium]
@@ -277,7 +277,7 @@ from the command line, you need to overwrite the HelperSet used by the command::
return $stream;
}
By setting the inputStream of the ``DialogHelper``, you imitate what the
By setting the input stream of the ``DialogHelper``, you imitate what the
console would do internally with all user input through the cli. This way
you can test any user interaction (even complex ones) by passing an appropriate
input stream.
@@ -11,7 +11,7 @@ When building a console application it may be useful to display tabular data:
.. image:: /images/components/console/table.png
To display table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`,
To display a table, use the :class:`Symfony\\Component\\Console\\Helper\\TableHelper`,
set headers, rows and render::
$table = $app->getHelperSet()->get('table');
@@ -197,8 +197,8 @@ level. For example::
}
When the quiet level is used, all output is suppressed as the default
:method:`Symfony\Component\Console\Output::write <Symfony\\Component\\Console\\Output\\Output::write>`
method returns without actually printing.
:method:`Symfony\\Component\\Console\\Output\\Output::write` method returns
without actually printing.
Using Command Arguments
-----------------------
@@ -286,13 +286,13 @@ Unlike arguments, options are not ordered (meaning you can specify them in any
order) and are specified with two dashes (e.g. ``--yell`` - you can also
declare a one-letter shortcut that you can call with a single dash like
``-y``). Options are *always* optional, and can be setup to accept a value
(e.g. ``dir=src``) or simply as a boolean flag without a value (e.g.
``yell``).
(e.g. ``--dir=src``) or simply as a boolean flag without a value (e.g.
``--yell``).
.. tip::
It is also possible to make an option *optionally* accept a value (so that
``--yell`` or ``yell=loud`` work). Options can also be configured to
``--yell`` or ``--yell=loud`` work). Options can also be configured to
accept an array of values.
For example, add a new option to the command that can be used to specify
@@ -344,7 +344,7 @@ Option Value
InputOption::VALUE_IS_ARRAY This option accepts multiple values (e.g. ``--dir=/foo --dir=/bar``)
InputOption::VALUE_NONE Do not accept input for this option (e.g. ``--yell``)
InputOption::VALUE_REQUIRED This value is required (e.g. ``--iterations=5``), the option itself is still optional
InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``yell`` or ``yell=loud``)
InputOption::VALUE_OPTIONAL This option may or may not have a value (e.g. ``--yell`` or ``--yell=loud``)
=========================== =====================================================================================
You can combine ``VALUE_IS_ARRAY`` with ``VALUE_REQUIRED`` or ``VALUE_OPTIONAL`` like this:
@@ -142,6 +142,18 @@ service by asking for the ``bar`` service like this::
$container->get('bar'); // Would return the foo service
.. tip::
In YAML, you can also use a shortcut to alias a service:
.. code-block:: yaml
services:
foo:
class: Example\Foo
bar: "@foo"
Requiring files
---------------
@@ -169,5 +181,5 @@ the service itself gets loaded. To do so, you can use the ``file`` directive.
$definition->setFile('%kernel.root_dir%/src/path/to/file/foo.php');
$container->setDefinition('foo', $definition);
Notice that Symfony will internally call the PHP function require_once
Notice that Symfony will internally call the PHP statement ``require_once``,
which means that your file will be included only once per request.
@@ -104,7 +104,7 @@ Add a method call with::
$definition->addMethodCall($method, $arguments);
Where ``$method`` is the method name and $arguments is an array of the arguments
Where ``$method`` is the method name and ``$arguments`` is an array of the arguments
to call the method with. The arguments can be strings, arrays, parameters or
service ids as with the constructor arguments.
@@ -9,7 +9,7 @@ The DependencyInjection Component
the way objects are constructed in your application.
For an introduction to Dependency Injection and service containers see
:doc:`/book/service_container`
:doc:`/book/service_container`.
Installation
------------
@@ -181,7 +181,7 @@ Setting Up the Container with Configuration Files
As well as setting up the services using PHP as above you can also use
configuration files. This allows you to use XML or YAML to write the definitions
for the services rather than using PHP to define the services as in the above
examples. In anything but the smallest applications it make sense to organize
examples. In anything but the smallest applications it makes sense to organize
the service definitions by moving them into one or more configuration files.
To do this you also need to install
:doc:`the Config component </components/config/introduction>`.
@@ -68,7 +68,7 @@ The service config for these classes would look something like this:
- [setEmailFormatter, ["@my_email_formatter"]]
greeting_card_manager:
class: "%greeting_card_manager.class%"
class: "%greeting_card_manager.class%"
calls:
- [setMailer, ["@my_mailer"]]
- [setEmailFormatter, ["@my_email_formatter"]]
@@ -235,6 +235,18 @@ To answer this, change the service declaration:
<tag name="acme_mailer.transport" alias="bar" />
</service>
.. code-block:: php
use Symfony\Component\DependencyInjection\Definition;
$definitionSmtp = new Definition('\Swift_SmtpTransport', array('%mailer_host%'));
$definitionSmtp->addTag('acme_mailer.transport', array('alias' => 'foo'));
$container->setDefinition('acme_mailer.transport.smtp', $definitionSmtp);
$definitionSendmail = new Definition('\Swift_SendmailTransport');
$definitionSendmail->addTag('acme_mailer.transport', array('alias' => 'bar'));
$container->setDefinition('acme_mailer.transport.sendmail', $definitionSendmail);
Notice that you've added a generic ``alias`` key to the tag. To actually
use this, update the compiler::
@@ -258,7 +258,7 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
$quality = $item->getQuality();
}
// accepts items are sorted by descending quality
// Accept header items are sorted by descending quality
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))
->all();
@@ -378,7 +378,7 @@ method::
$response->send();
}
If the Response is not modified, it sets the status code to 304 and remove the
If the Response is not modified, it sets the status code to 304 and removes the
actual response content.
Redirecting the User
@@ -322,7 +322,7 @@ You can also mix objects and arrays::
public function setChildren($children)
{
return $this->children;
$this->children = $children;
}
public function getChildren()
@@ -73,17 +73,17 @@ Defining routes
A full route definition can contain up to seven parts:
1. The URL path route. This is matched against the URL passed to the `RequestContext`,
and can contain named wildcard placeholders (e.g. ``{placeholders}``)
to match dynamic parts in the URL.
and can contain named wildcard placeholders (e.g. ``{placeholders}``)
to match dynamic parts in the URL.
2. An array of default values. This contains an array of arbitrary values
that will be returned when the request matches the route.
that will be returned when the request matches the route.
3. An array of requirements. These define constraints for the values of the
placeholders as regular expressions.
placeholders as regular expressions.
4. An array of options. These contain internal settings for the route and
are the least commonly needed.
are the least commonly needed.
5. A host. This is matched against the host of the request. See
:doc:`/components/routing/hostname_pattern` for more details.
@@ -95,7 +95,7 @@ The second step is done by creating message catalogs that define the translation
for any number of different locales.
Creating Translations
=====================
---------------------
The act of creating translation files is an important part of "localization"
(often abbreviated `L10n`_). Translation files consist of a series of
@@ -12,7 +12,7 @@ things like controllers, templates, and other files in a bundle's
For example, suppose that you're installing the `FOSUserBundle`_, but you
want to override its base ``layout.html.twig`` template, as well as one of
its controllers. Suppose also that you have your own ``AcmeUserBundle``
its controllers. Suppose also that you have your own AcmeUserBundle
where you want the overridden files to live. Start by registering the FOSUserBundle
as the "parent" of your bundle::
@@ -181,7 +181,7 @@ can override the translations from any translation file, as long as it is in
.. caution::
The last translation file always wins. That mean that you need to make
The last translation file always wins. That means that you need to make
sure that the bundle containing *your* translations is loaded after any
bundle whose translations you're overriding. This is done in ``AppKernel``.
Oops, something went wrong.

0 comments on commit 04cf9f8

Please sign in to comment.