Skip to content

[WIP] Add section for rendering a custom prototype for collections #1998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 106 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
6e3bc9f
Created paragraph for prototype customization.
Nov 29, 2012
931715a
Added twig-syntax for data-prototype.
Nov 29, 2012
f5c6876
Added reusing of prototype template for displaying items from collect…
Dec 3, 2012
83ae106
Formatting.
Dec 3, 2012
e42a5a5
Use double ticks for inline code.
Dec 4, 2012
e222ee1
Moved hyperlink to the bottom.
Dec 4, 2012
a4f53b5
Added PHP examples.
Jan 2, 2013
52f17a3
Added missing closing paranthesis
Aug 22, 2014
9ddfc58
Fixed code blocks syntax.
Aug 22, 2014
3272cfc
Readded missing link targets.
Aug 22, 2014
c483a90
Removed outdated translations from the official list
wouterj Jul 31, 2014
9b0cef4
Fix documentation for group_sequence_provider
giosh94mhz Aug 18, 2014
30e993d
document multiple recipients in XML configs
xabbuh Aug 17, 2014
2c69be5
tweaks for the web server configuration chapter
xabbuh Aug 17, 2014
cb2ba28
Fixed minor typos.
ahsio Aug 22, 2014
0a4acc3
Removing extra whitespace
weaverryan Aug 22, 2014
ca43765
Added the schema_filter option to the reference
peterrehm Aug 20, 2014
8e019f5
Added custom format page to translation component
raulfraile Aug 22, 2014
dd161e3
Link from introduction section
raulfraile Aug 22, 2014
20a3385
Small fixes
raulfraile Aug 22, 2014
3b105c7
Cleanups
raulfraile Aug 22, 2014
afd0365
Fixed version for composer install
zomberg Aug 23, 2014
f560f82
Improvements based on comments
raulfraile Aug 23, 2014
981739a
Extra improvements based on comments
raulfraile Aug 24, 2014
d6de597
Fixed wrong indentation
raulfraile Aug 24, 2014
fa24ac6
Updated for CMF doc refactoring
wouterj Aug 25, 2014
0a4d5c5
Adding 'attr' option to the Textarea options list
ronanguilloux Aug 20, 2014
f93cca0
[Reference] consistent & complete config examples
xabbuh Aug 21, 2014
acf5d28
Update voters.rst
Aug 22, 2014
cdf2134
fixes environment/application mistake
phpeek Aug 25, 2014
4bb0f65
Improved custom formats article based on comments
raulfraile Aug 26, 2014
93ae940
Added note about exporting SYMFONY_ENV
jasonbouffard Aug 27, 2014
f3b942e
New service to simplify password encoding
aferrandini Aug 26, 2014
819c53c
Route description correction.
Aug 27, 2014
9f6590b
add link to form testing chapter in test section
xabbuh Aug 30, 2014
1fd5af4
Link to FOSHttpCacheBundle
ddeboer Aug 24, 2014
44e8ae0
Update datetime.rst
althaus Aug 28, 2014
d41ed6c
Update datetime.rst
althaus Aug 29, 2014
1a001c7
Update home of DoctrineExtensions.
rubenrua Aug 28, 2014
4ea3f8d
Moved 'contributing' images to their own directory
javiereguiluz Sep 5, 2014
86be71c
fix name of the Yaml component
xabbuh Sep 5, 2014
4238aad
replace "Symfony2" with "Symfony"
xabbuh Sep 5, 2014
3ee5187
Added a note about the lacking features of Yaml Component
javiereguiluz Sep 6, 2014
227d366
Fix method for adding placholders in progressBar
danez Sep 6, 2014
f6ff985
The name of the placeholder must not be encapsulated in %
danez Sep 6, 2014
f6a3c28
Missing backtick, thanks to @Baptouuuu
wouterj Sep 8, 2014
9372cde
Reverts c723d8dd546412b08ffaf3846b5574f4f4021418
wouterj Sep 8, 2014
727744c
Missing backtick, thanks to @Baptouuuu
wouterj Sep 8, 2014
5bae1e1
Fixed code highlighting
wouterj Sep 9, 2014
b9a7381
Caution that roles should start with ROLE_
jrjohnson Sep 12, 2014
3f0e5b6
Added a note about the side effects of enabling both PHP and Twig
javiereguiluz Sep 12, 2014
3689506
Add formatting, links, and clarity
jrjohnson Sep 12, 2014
5aa2ea0
Add label book-security-roles
jrjohnson Sep 12, 2014
b78465b
Fix reference label
jrjohnson Sep 12, 2014
a0f318e
do not reference services in parameters
xabbuh Sep 13, 2014
4458f7e
Revamped the documentation about "Contributing Docs"
javiereguiluz Sep 13, 2014
5b53d6a
Added missing link
javiereguiluz Sep 13, 2014
9a49cf2
lways use absolute links instead of relative for internal doc links
javiereguiluz Sep 13, 2014
5173705
Switched another relative link into an absolute reference
javiereguiluz Sep 13, 2014
f2043eb
Added a note about not using relative internal links in the doc
javiereguiluz Sep 13, 2014
709f82a
Added lots of fixes suggested by reviewers
javiereguiluz Sep 13, 2014
1cbf5fa
Added another bunch of fixes suggested by reviewers
javiereguiluz Sep 13, 2014
82ae880
More and more fixes and improvements
javiereguiluz Sep 13, 2014
216d086
Improved the explanation thanks to @stof comments
javiereguiluz Sep 13, 2014
6ac5c55
Reworded the explanation about the limitation of enablin PHP templates
javiereguiluz Sep 13, 2014
32cc0c7
Update Collection.rst
azarzag Sep 11, 2014
cc5ac25
Removed two highlight formats which are "experimental" and not
javiereguiluz Sep 15, 2014
7ed8f00
Fixed all the errors found by Ryan
javiereguiluz Sep 15, 2014
8821052
caution on `null` values in Expression constraint
xabbuh Sep 5, 2014
e5ea1b1
Move debug command to the debug namespace
Sep 15, 2014
edd2f8d
[#4166] Fixing small typo
weaverryan Sep 16, 2014
28d10e2
Cache needs be cleared
marcel-burkhard Sep 12, 2014
3ad7d3c
Update override_dir_structure.rst
marcel-burkhard Sep 16, 2014
e1947af
First draft of the bundle installation instructions
javiereguiluz Aug 22, 2014
8078bbe
Applied all the fixes and suggestions made by reviewers
javiereguiluz Aug 22, 2014
5a95d43
Fixed minor typo
javiereguiluz Aug 22, 2014
b285fac
More improvements based on reviewers' comments
javiereguiluz Aug 22, 2014
c0d447c
Fixed some code formatting
javiereguiluz Aug 22, 2014
242d410
Removed the first person perspective and other minor fixes
javiereguiluz Aug 22, 2014
376f009
More tweaks and fixes
javiereguiluz Aug 22, 2014
aca99bb
Minor fixes and tweaks
javiereguiluz Aug 23, 2014
ae1c12d
Removed the sidebar and made some minor tweaks
javiereguiluz Aug 23, 2014
7769b89
Reworded a bit the installation instructions
javiereguiluz Aug 23, 2014
45d0e00
Added the fixes suggested by Ryan
javiereguiluz Aug 27, 2014
3908ed2
Handle "constraints" option in form unit testing
sarcher Sep 8, 2014
69f77cd
Fixed return value
sarcher Sep 8, 2014
396f94f
fix ContainerAwareEventDispatcher definition
xabbuh Sep 16, 2014
511c418
link translation DIC tags to components section
xabbuh Sep 17, 2014
ff157a4
provide node path on configuration
desarrolla2 Sep 18, 2014
36e9741
Update uglifyjs.rst
desarrolla2 Sep 18, 2014
48b3194
Update uglifyjs.rst
desarrolla2 Sep 18, 2014
aa4c827
update uglifyjs.rst
desarrolla2 Sep 18, 2014
621a6c1
[#4249] Tiny tweak to language
weaverryan Sep 18, 2014
a86977c
Removed unnecessary comma
allejo Sep 19, 2014
37f5010
Update remove.rst
Ha99y Jun 10, 2014
d6d4bcc
Update remove.rst
Ha99y Jun 11, 2014
39f14b2
Update remove.rst
Ha99y Jun 11, 2014
c785b83
Applied comments
wouterj Sep 16, 2014
4f14285
Remove redundant references to trusting HttpCache
thewilkybarkid Sep 16, 2014
61e1245
Clarify that route defaults don't need a placeholder
iamdto Jul 11, 2014
984b46e
[Twig][Form] Moved twig.form.resources to a higher level
Jul 7, 2014
2e1488e
Created paragraph for prototype customization.
Nov 29, 2012
4590c01
Added twig-syntax for data-prototype.
Nov 29, 2012
11e38cc
Added reusing of prototype template for displaying items from collect…
Dec 3, 2012
a3147d2
Formatting.
Dec 3, 2012
ee3fc29
Capitalize the headline and add punctuation.
Sep 19, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 23 additions & 20 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Controller
==========

A controller is a PHP function you create that takes information from the
HTTP request and constructs and returns an HTTP response (as a Symfony2
HTTP request and constructs and returns an HTTP response (as a Symfony
``Response`` object). The response could be an HTML page, an XML document,
a serialized JSON array, an image, a redirect, a 404 error or anything else
you can dream up. The controller contains whatever arbitrary logic *your
application* needs to render the content of a page.

See how simple this is by looking at a Symfony2 controller in action.
See how simple this is by looking at a Symfony controller in action.
The following controller would render a page that simply prints ``Hello world!``::

use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -50,7 +50,7 @@ common examples:
Requests, Controller, Response Lifecycle
----------------------------------------

Every request handled by a Symfony2 project goes through the same simple lifecycle.
Every request handled by a Symfony project goes through the same simple lifecycle.
The framework takes care of the repetitive tasks and ultimately executes a
controller, which houses your custom application code:

Expand Down Expand Up @@ -87,7 +87,7 @@ A Simple Controller
-------------------

While a controller can be any PHP callable (a function, method on an object,
or a ``Closure``), in Symfony2, a controller is usually a single method inside
or a ``Closure``), in Symfony, a controller is usually a single method inside
a controller object. Controllers are also called *actions*.

.. code-block:: php
Expand Down Expand Up @@ -117,7 +117,7 @@ a controller object. Controllers are also called *actions*.

This controller is pretty straightforward:

* *line 4*: Symfony2 takes advantage of PHP 5.3 namespace functionality to
* *line 4*: Symfony takes advantage of PHP 5.3 namespace functionality to
namespace the entire controller class. The ``use`` keyword imports the
``Response`` class, which the controller must return.

Expand Down Expand Up @@ -185,8 +185,8 @@ controller and passes in ``ryan`` for the ``$name`` variable. Creating a
"page" means simply creating a controller method and associated route.

Notice the syntax used to refer to the controller: ``AcmeHelloBundle:Hello:index``.
Symfony2 uses a flexible string notation to refer to different controllers.
This is the most common syntax and tells Symfony2 to look for a controller
Symfony uses a flexible string notation to refer to different controllers.
This is the most common syntax and tells Symfony to look for a controller
class called ``HelloController`` inside a bundle named ``AcmeHelloBundle``. The
method ``indexAction()`` is then executed.

Expand Down Expand Up @@ -232,7 +232,7 @@ passed to that method::

The controller has a single argument, ``$name``, which corresponds to the
``{name}`` parameter from the matched route (``ryan`` in the example). In
fact, when executing your controller, Symfony2 matches each argument of
fact, when executing your controller, Symfony matches each argument of
the controller with a parameter from the matched route. Take the following
example:

Expand Down Expand Up @@ -369,7 +369,7 @@ Use it! See :doc:`/cookbook/templating/render_without_controller`.
The Base Controller Class
-------------------------

For convenience, Symfony2 comes with a base ``Controller`` class that assists
For convenience, Symfony comes with a base ``Controller`` class that assists
with some of the most common controller tasks and gives your controller class
access to any resource it might need. By extending this ``Controller`` class,
you can take advantage of several helper methods.
Expand All @@ -393,7 +393,7 @@ Add the ``use`` statement atop the ``Controller`` class and then modify the

This doesn't actually change anything about how your controller works. In
the next section, you'll learn about the helper methods that the base controller
class makes available. These methods are just shortcuts to using core Symfony2
class makes available. These methods are just shortcuts to using core Symfony
functionality that's available to you with or without the use of the base
``Controller`` class. A great way to see the core functionality in action
is to look in the
Expand Down Expand Up @@ -427,7 +427,7 @@ Common Controller Tasks
Though a controller can do virtually anything, most controllers will perform
the same basic tasks over and over again. These tasks, such as redirecting,
forwarding, rendering templates and accessing core services, are very easy
to manage in Symfony2.
to manage in Symfony.

.. index::
single: Controller; Redirecting
Expand Down Expand Up @@ -501,15 +501,15 @@ look something like the following::
}

And just like when creating a controller for a route, the order of the arguments
to ``fancyAction`` doesn't matter. Symfony2 matches the index key names
to ``fancyAction`` doesn't matter. Symfony matches the index key names
(e.g. ``name``) with the method argument names (e.g. ``$name``). If you
change the order of the arguments, Symfony2 will still pass the correct
change the order of the arguments, Symfony will still pass the correct
value to each variable.

.. tip::

Like other base ``Controller`` methods, the ``forward`` method is just
a shortcut for core Symfony2 functionality. A forward can be accomplished
a shortcut for core Symfony functionality. A forward can be accomplished
directly by duplicating the current request. When this
:ref:`sub request <http-kernel-sub-requests>` is executed via the ``http_kernel``
service the ``HttpKernel`` returns a ``Response`` object::
Expand Down Expand Up @@ -603,7 +603,7 @@ The Symfony templating engine is explained in great detail in the
Accessing other Services
~~~~~~~~~~~~~~~~~~~~~~~~

When extending the base controller class, you can access any Symfony2 service
When extending the base controller class, you can access any Symfony service
via the ``get()`` method. Here are several common services you might need::

$templating = $this->get('templating');
Expand All @@ -613,12 +613,15 @@ via the ``get()`` method. Here are several common services you might need::
$mailer = $this->get('mailer');

There are countless other services available and you are encouraged to define
your own. To list all available services, use the ``container:debug`` console
your own. To list all available services, use the ``debug:container`` console
command:

.. code-block:: bash

$ php app/console container:debug
$ php app/console debug:container

.. versionadded:: 2.6
Prior to Symfony 2.6, this command was called ``container:debug``.

For more information, see the :doc:`/book/service_container` chapter.

Expand Down Expand Up @@ -648,7 +651,7 @@ The ``createNotFoundException()`` method creates a special ``NotFoundHttpExcepti
object, which ultimately triggers a 404 HTTP response inside Symfony.

Of course, you're free to throw any ``Exception`` class in your controller -
Symfony2 will automatically return a 500 HTTP response code.
Symfony will automatically return a 500 HTTP response code.

.. code-block:: php

Expand All @@ -666,9 +669,9 @@ Both of these error pages can be customized. For details, read the
Managing the Session
--------------------

Symfony2 provides a nice session object that you can use to store information
Symfony provides a nice session object that you can use to store information
about the user (be it a real person using a browser, a bot, or a web service)
between requests. By default, Symfony2 stores the attributes in a cookie
between requests. By default, Symfony stores the attributes in a cookie
by using the native PHP sessions.

Storing and retrieving information from the session can be easily achieved
Expand Down
2 changes: 1 addition & 1 deletion book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ for you:

.. sidebar:: Setting up the Database to be UTF8

One mistake even seasoned developers make when starting a Symfony2 project
One mistake even seasoned developers make when starting a Symfony project
is forgetting to setup default charset and collation on their database,
ending up with latin type collations, which are default for most databases.
They might even remember to do it the very first time, but forget that
Expand Down
20 changes: 10 additions & 10 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ Forms
=====

Dealing with HTML forms is one of the most common - and challenging - tasks for
a web developer. Symfony2 integrates a Form component that makes dealing with
a web developer. Symfony integrates a Form component that makes dealing with
forms easy. In this chapter, you'll build a complex form from the ground-up,
learning the most important features of the form library along the way.

.. note::

The Symfony Form component is a standalone library that can be used outside
of Symfony2 projects. For more information, see the `Symfony2 Form component`_
of Symfony projects. For more information, see the `Symfony Form component`_
on GitHub.

.. index::
Expand Down Expand Up @@ -80,7 +80,7 @@ Building the Form
~~~~~~~~~~~~~~~~~

Now that you've created a ``Task`` class, the next step is to create and
render the actual HTML form. In Symfony2, this is done by building a form
render the actual HTML form. In Symfony, this is done by building a form
object and then rendering it in a template. For now, this can all be done
from inside a controller::

Expand Down Expand Up @@ -119,7 +119,7 @@ from inside a controller::
how to build your form in a standalone class, which is recommended as
your form becomes reusable.

Creating a form requires relatively little code because Symfony2 form objects
Creating a form requires relatively little code because Symfony form objects
are built with a "form builder". The form builder's purpose is to allow you
to write simple form "recipes", and have it do all the heavy-lifting of actually
building the form.
Expand All @@ -136,7 +136,7 @@ the server.
Support for submit buttons was introduced in Symfony 2.3. Before that, you had
to add buttons to the form's HTML manually.

Symfony2 comes with many built-in types that will be discussed shortly
Symfony comes with many built-in types that will be discussed shortly
(see :ref:`book-forms-type-reference`).

.. index::
Expand Down Expand Up @@ -318,7 +318,7 @@ Form Validation
---------------

In the previous section, you learned how a form can be submitted with valid
or invalid data. In Symfony2, validation is applied to the underlying object
or invalid data. In Symfony, validation is applied to the underlying object
(e.g. ``Task``). In other words, the question isn't whether the "form" is
valid, but whether or not the ``$task`` object is valid after the form has
applied the submitted data to it. Calling ``$form->isValid()`` is a shortcut
Expand Down Expand Up @@ -441,7 +441,7 @@ corresponding errors printed out with the form.
'attr' => array('novalidate' => 'novalidate'),
)) ?>

Validation is a very powerful feature of Symfony2 and has its own
Validation is a very powerful feature of Symfony and has its own
:doc:`dedicated chapter </book/validation>`.

.. index::
Expand Down Expand Up @@ -982,9 +982,9 @@ to the ``form()`` or the ``form_start()`` helper:

.. note::

If the form's method is not GET or POST, but PUT, PATCH or DELETE, Symfony2
If the form's method is not GET or POST, but PUT, PATCH or DELETE, Symfony
will insert a hidden field with the name ``_method`` that stores this method.
The form will be submitted in a normal POST request, but Symfony2's router
The form will be submitted in a normal POST request, but Symfony's router
is capable of detecting the ``_method`` parameter and will interpret it as
a PUT, PATCH or DELETE request. Read the cookbook chapter
":doc:`/cookbook/routing/method_parameters`" for more information.
Expand Down Expand Up @@ -1901,7 +1901,7 @@ Learn more from the Cookbook
* :doc:`/cookbook/form/dynamic_form_modification`
* :doc:`/cookbook/form/data_transformers`

.. _`Symfony2 Form component`: https://github.com/symfony/Form
.. _`Symfony Form component`: https://github.com/symfony/Form
.. _`DateTime`: http://php.net/manual/en/class.datetime.php
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Twig
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
Expand Down
Loading