Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d505335

Browse files
committed
Merge branch '2.1'
2 parents 46fe35f + 1522f3c commit d505335

33 files changed

+616
-97
lines changed

README.markdown

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Contributing
77
------------
88

99
>**Note**
10-
>Unless you're documenting a feature that's new to Symfony 2.1, all pull
11-
>requests must be based off of the **2.0** branch, **not** the master branch.
10+
>Unless you're documenting a feature that's new to a specific version of Symfony
11+
>(e.g. Symfony 2.1), all pull requests must be based off of the **2.0** branch,
12+
>**not** the master or 2.1 branch.
1213
1314
We love contributors! For more information on how you can contribute to the
14-
Symfony documentation, please read [Contributing to the Documentation](http://symfony.com/doc/current/contributing/documentation/overview.html)
15+
Symfony documentation, please read
16+
[Contributing to the Documentation](http://symfony.com/doc/current/contributing/documentation/overview.html)

book/forms.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -867,14 +867,14 @@ the choice is ultimately up to you.
867867

868868
In cases where you need extra fields in the form (for example: a "do you
869869
agree with these terms" checkbox) that will not be mapped to the underlying
870-
object, you need to set the property_path option to ``false``::
870+
object, you need to set the ``mapped`` option to ``false``::
871871

872872
use Symfony\Component\Form\FormBuilderInterface;
873873

874874
public function buildForm(FormBuilderInterface $builder, array $options)
875875
{
876876
$builder->add('task');
877-
$builder->add('dueDate', null, array('property_path' => false));
877+
$builder->add('dueDate', null, array('mapped' => false));
878878
}
879879

880880
Additionally, if there are any fields on the form that aren't included in
@@ -1022,12 +1022,12 @@ class:
10221022
10231023
The fields from ``CategoryType`` can now be rendered alongside those from
10241024
the ``TaskType`` class. To activate validation on CategoryType, add
1025-
the ``cascade_validation`` option::
1025+
the ``cascade_validation`` option to ``TaskType``::
10261026

10271027
public function setDefaultOptions(OptionsResolverInterface $resolver)
10281028
{
10291029
$resolver->setDefaults(array(
1030-
'data_class' => 'Acme\TaskBundle\Entity\Category',
1030+
'data_class' => 'Acme\TaskBundle\Entity\Task',
10311031
'cascade_validation' => true,
10321032
));
10331033
}
@@ -1221,13 +1221,13 @@ rendered (e.g. ``label``, ``widget``, ``errors``, etc). By default, there
12211221
are 4 possible *parts* of a form that can be rendered:
12221222

12231223
+-------------+--------------------------+---------------------------------------------------------+
1224-
| ``label`` | (e.g. ``form_label``) | renders the field's label |
1224+
| ``label`` | (e.g. ``form_label``) | renders the field's label |
12251225
+-------------+--------------------------+---------------------------------------------------------+
1226-
| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation |
1226+
| ``widget`` | (e.g. ``form_widget``) | renders the field's HTML representation |
12271227
+-------------+--------------------------+---------------------------------------------------------+
1228-
| ``errors`` | (e.g. ``form_errors``) | renders the field's errors |
1228+
| ``errors`` | (e.g. ``form_errors``) | renders the field's errors |
12291229
+-------------+--------------------------+---------------------------------------------------------+
1230-
| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) |
1230+
| ``row`` | (e.g. ``form_row``) | renders the field's entire row (label, widget & errors) |
12311231
+-------------+--------------------------+---------------------------------------------------------+
12321232

12331233
.. note::
@@ -1543,7 +1543,7 @@ but here's a short example::
15431543

15441544
// create a form, no default values, pass in the constraint option
15451545
$form = $this->createFormBuilder(null, array(
1546-
'validation_constraint' => $collectionConstraint,
1546+
'constraints' => $collectionConstraint,
15471547
))->add('email', 'email')
15481548
// ...
15491549
;
@@ -1573,7 +1573,7 @@ method to specify the option::
15731573
));
15741574

15751575
$resolver->setDefaults(array(
1576-
'validation_constraint' => $collectionConstraint
1576+
'constraints' => $collectionConstraint
15771577
));
15781578
}
15791579
}

book/http_cache.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ independent of the rest of the page.
857857
public function indexAction()
858858
{
859859
$response = $this->render('MyBundle:MyController:index.html.twig');
860-
// set the shared max age - the also marks the response as public
860+
// set the shared max age - which also marks the response as public
861861
$response->setSharedMaxAge(600);
862862
863863
return $response;

book/templating.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,17 @@ Throughout this chapter, template examples will be shown in both Twig and PHP.
128128
and benefit from this distinction. And of course, you'll be loved by
129129
web designers everywhere.
130130

131-
Twig can also do things that PHP can't, such as whitespace control, sandboxing,
132-
and the inclusion of custom functions and filters that only affect templates.
133-
Twig contains little features that make writing templates easier and
134-
more concise. Take the following example, which combines a loop with
135-
a logical ``if`` statement:
131+
Twig can also do things that PHP can't, such as whitespace control,
132+
sandboxing, automatic and contextual output escaping, and the inclusion of
133+
custom functions and filters that only affect templates. Twig contains
134+
little features that make writing templates easier and more concise. Take
135+
the following example, which combines a loop with a logical ``if``
136+
statement:
136137

137138
.. code-block:: html+jinja
138139

139140
<ul>
140-
{% for user in users %}
141+
{% for user in users if user.active %}
141142
<li>{{ user.username }}</li>
142143
{% else %}
143144
<li>No users found</li>
@@ -981,7 +982,7 @@ you're actually using the templating engine service. For example::
981982

982983
return $this->render('AcmeArticleBundle:Article:index.html.twig');
983984

984-
is equivalent to:
985+
is equivalent to::
985986

986987
$engine = $this->container->get('templating');
987988
$content = $engine->render('AcmeArticleBundle:Article:index.html.twig');

components/console/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ Console
66

77
introduction
88
usage
9+
single_command_tool

components/console/introduction.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,3 +472,9 @@ returns the returned code from the command (return value from command's
472472
something and display feedback to the user. So, instead of calling a
473473
command from the Web, refactor your code and move the logic to a new
474474
class.
475+
476+
Learn More!
477+
-----------
478+
479+
* :doc:`/components/console/usage`
480+
* :doc:`/components/console/single_command_tool`
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
.. index::
2+
single: Console; Single command application
3+
4+
How to build an Application that is a single Command
5+
====================================================
6+
7+
When building a command line tool, you may not need to provide several commands.
8+
In such case, having to pass the command name each time is tedious. Fortunately,
9+
it is possible to remove this need by extending the application::
10+
11+
namespace Acme\Tool;
12+
13+
use Symfony\Component\Console\Application;
14+
use Symfony\Component\Console\Input\InputInterface;
15+
16+
class MyApplication extends Application
17+
{
18+
/**
19+
* Gets the name of the command based on input.
20+
*
21+
* @param InputInterface $input The input interface
22+
*
23+
* @return string The command name
24+
*/
25+
protected function getCommandName(InputInterface $input)
26+
{
27+
// This should return the name of your command.
28+
return 'my_command';
29+
}
30+
31+
/**
32+
* Gets the default commands that should always be available.
33+
*
34+
* @return array An array of default Command instances
35+
*/
36+
protected function getDefaultCommands()
37+
{
38+
// Keep the core default commands to have the HelpCommand
39+
// which is used when using the --help option
40+
$defaultCommands = parent::getDefaultCommands()
41+
42+
$defaultCommands[] = new MyCommand();
43+
44+
return $defaultCommands;
45+
}
46+
}
47+
48+
When calling your console script, the command `MyCommand` will then always
49+
be used, without having to pass its name.

components/console/usage.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
.. index::
22
single: Console; Usage
33

4-
Console Usage
5-
=============
4+
Using Console Commands, Shortcuts and Built-in Commands
5+
=======================================================
66

77
In addition to the options you specify for your commands, there are some
88
built-in options as well as a couple of built-in commands for the console component.

components/dom_crawler.rst

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,16 @@ instance with just the selected link(s). Calling ``link()`` gives us a special
192192
The :class:`Symfony\\Component\\DomCrawler\\Link` object has several useful
193193
methods to get more information about the selected link itself::
194194

195-
// return the raw href value
196-
$href = $link->getRawUri();
197-
198195
// return the proper URI that can be used to make another request
199196
$uri = $link->getUri();
200197

201-
The ``getUri()`` is especially useful as it cleans the ``href`` value and
202-
transforms it into how it should really be processed. For example, for a
203-
link with ``href="#foo"``, this would return the full URI of the current
204-
page suffixed with ``#foo``. The return from ``getUri()`` is always a full
205-
URI that you can act on.
198+
.. note::
199+
200+
The ``getUri()`` is especially useful as it cleans the ``href`` value and
201+
transforms it into how it should really be processed. For example, for a
202+
link with ``href="#foo"``, this would return the full URI of the current
203+
page suffixed with ``#foo``. The return from ``getUri()`` is always a full
204+
URI that you can act on.
206205

207206
Forms
208207
.....

components/http_foundation/session_configuration.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ The :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionS
9292
can configure most of the PHP ini configuration directives which are documented
9393
at `php.net/session.configuration`_.
9494

95-
To configure these setting, pass the keys (omitting the initial ``session.`` part
95+
To configure these settings, pass the keys (omitting the initial ``session.`` part
9696
of the key) as a key-value array to the ``$options`` constructor argument.
9797
Or set them via the
9898
:method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\NativeSessionStorage::setOptions`
@@ -133,7 +133,7 @@ example if these were set to ``5/100`` respectively, it would mean a probability
133133
of 5%. Similarly, ``3/4`` would mean a 3 in 4 chance of being called, i.e. 75%.
134134

135135
If the garbage collection handler is invoked, PHP will pass the value stored in
136-
the PHP ini directive ``session.gc_maxlifetime`. The meaning in this context is
136+
the PHP ini directive ``session.gc_maxlifetime``. The meaning in this context is
137137
that any stored session that was saved more than ``maxlifetime`` ago should be
138138
deleted. This allows one to expire records based on idle time.
139139

@@ -163,7 +163,7 @@ calculated by adding the PHP runtime configuration value in
163163

164164
.. note::
165165

166-
A cookie lifetime of ``0`` means the cookie expire when the browser is closed.
166+
A cookie lifetime of ``0`` means the cookie expires when the browser is closed.
167167

168168
Session Idle Time/Keep Alive
169169
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -254,7 +254,7 @@ will be used to wrap any custom save handlers, that implement :phpclass:`Session
254254
Under PHP 5.4 and above, all session handlers implement :phpclass:`SessionHandlerInterface`
255255
including `Native*SessionHandler` classes which inherit from :phpclass:`SessionHandler`.
256256

257-
The proxy mechanism allow you to get more deeply involved in session save handler
257+
The proxy mechanism allows you to get more deeply involved in session save handler
258258
classes. A proxy for example could be used to encrypt any session transaction
259259
without knowledge of the specific save handler.
260260

components/map.rst.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
* :doc:`/components/console/introduction`
1515
* :doc:`/components/console/usage`
16+
* :doc:`/components/console/single_command_tool`
1617

1718
* **CSS Selector**
1819

components/process.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ instead::
6060

6161
$process = new PhpProcess(<<<EOF
6262
<?php echo 'Hello World'; ?>
63-
EOF);
63+
EOF
64+
);
6465
$process->run();
6566

6667
.. versionadded:: 2.1

components/templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ sub-template to set its parent template.
8787
To use template inheritance, the :class:`Symfony\\Component\\Templating\\Helper\\SlotsHelper`
8888
helper must be registered::
8989

90-
use Symfony\Templating\Helper\SlotsHelper;
90+
use Symfony\Component\Templating\Helper\SlotsHelper;
9191

9292
$view->set(new SlotsHelper());
9393

cookbook/assetic/asset_management.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ directly:
2424
<script src="<?php echo $view['assets']->getUrl('js/script.js') ?>" type="text/javascript" />
2525
2626
But *with* Assetic, you can manipulate these assets however you want (or
27-
load them from anywhere) before serving them. These means you can:
27+
load them from anywhere) before serving them. This means you can:
2828
2929
* Minify and combine all of your CSS and JS files
3030

cookbook/assetic/yuicompressor.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,4 @@ apply this filter when debug mode is off.
157157

158158

159159
.. _`YUI Compressor`: http://developer.yahoo.com/yui/compressor/
160-
.. _`Download the JAR`: http://yuilibrary.com/downloads/#yuicompressor
160+
.. _`Download the JAR`: http://yuilibrary.com/projects/yuicompressor/

cookbook/configuration/override_dir_structure.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ in the ``AppKernel`` class of you application::
4646
is the current environment (i.e. ``dev``). In this case we have changed
4747
the location of the cache directory to ``app/{environment}/cache``.
4848

49-
.. warning::
49+
.. caution::
5050

5151
You should keep the ``cache`` directory different for each environment,
5252
otherwise some unexpected behaviour may happen. Each environment generates

cookbook/doctrine/dbal.rst

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,8 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document
108108
109109
<doctrine:config>
110110
<doctrine:dbal>
111-
<doctrine:dbal default-connection="default">
112-
<doctrine:connection>
113-
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
114-
</doctrine:connection>
111+
<doctrine:type name="custom_first" class="Acme\HelloBundle\Type\CustomFirst" />
112+
<doctrine:type name="custom_second" class="Acme\HelloBundle\Type\CustomSecond" />
115113
</doctrine:dbal>
116114
</doctrine:config>
117115
</container>
@@ -121,12 +119,9 @@ mapping types, read Doctrine's `Custom Mapping Types`_ section of their document
121119
// app/config/config.php
122120
$container->loadFromExtension('doctrine', array(
123121
'dbal' => array(
124-
'connections' => array(
125-
'default' => array(
126-
'mapping_types' => array(
127-
'enum' => 'string',
128-
),
129-
),
122+
'types' => array(
123+
'custom_first' => 'Acme\HelloBundle\Type\CustomFirst',
124+
'custom_second' => 'Acme\HelloBundle\Type\CustomSecond',
130125
),
131126
),
132127
));
@@ -165,8 +160,10 @@ mapping type:
165160
166161
<doctrine:config>
167162
<doctrine:dbal>
168-
<doctrine:type name="custom_first" class="Acme\HelloBundle\Type\CustomFirst" />
169-
<doctrine:type name="custom_second" class="Acme\HelloBundle\Type\CustomSecond" />
163+
<doctrine:dbal default-connection="default">
164+
<doctrine:connection>
165+
<doctrine:mapping-type name="enum">string</doctrine:mapping-type>
166+
</doctrine:connection>
170167
</doctrine:dbal>
171168
</doctrine:config>
172169
</container>
@@ -176,9 +173,12 @@ mapping type:
176173
// app/config/config.php
177174
$container->loadFromExtension('doctrine', array(
178175
'dbal' => array(
179-
'types' => array(
180-
'custom_first' => 'Acme\HelloBundle\Type\CustomFirst',
181-
'custom_second' => 'Acme\HelloBundle\Type\CustomSecond',
176+
'connections' => array(
177+
'default' => array(
178+
'mapping_types' => array(
179+
'enum' => 'string',
180+
),
181+
),
182182
),
183183
),
184184
));

cookbook/doctrine/resolve_target_entity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
How to Define Relationships with Abstract Classes and Interfaces
66
================================================================
77

8-
.. versionadded: 2.1
8+
.. versionadded:: 2.1
99
The ResolveTargetEntityListener is new to Doctrine 2.2, which was first
1010
packaged with Symfony 2.1.
1111

0 commit comments

Comments
 (0)