8000 Merge branch '2.0' into 2.1 · symfony/symfony-docs@1522f3c · GitHub
[go: up one dir, main page]

Skip to content

Commit 1522f3c

Browse files
committed
Merge branch '2.0' into 2.1
2 parents 5e32e8a + d269056 commit 1522f3c

File tree

8 files changed

+56
-46
lines changed

8 files changed

+56
-46
lines changed

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,7 @@ you're actually using the templating engine service. For example::
982982

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

985-
is equivalent to:
985+
is equivalent to::
986986

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

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/profiler/data_collector.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ tag in your configuration. For example, assuming your template is in some
154154
data_collector.your_collector_name:
155155
class: Acme\DebugBundle\Collector\Class\Name
156156
tags:
157-
- { name: data_collector, template: "AcmeDebug:Collector:templatename", id: "your_collector_name" }
157+
- { name: data_collector, template: "AcmeDebugBundle:Collector:templatename", id: "your_collector_name" }
158158
159159
.. code-block:: xml
160160
161161
<service id="data_collector.your_collector_name" class="Acme\DebugBundle\Collector\Class\Name">
162-
<tag name="data_collector" template="AcmeDebug:Collector:templatename" id="your_collector_name" />
162+
<tag name="data_collector" template="AcmeDebugBundle:Collector:templatename" id="your_collector_name" />
163163
</service>
164164
165165
.. code-block:: php

cookbook/service_container/event_listener.rst

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,28 @@ event is just one of the core kernel events::
1919

2020
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
2121
use Symfony\Component\HttpFoundation\Response;
22+
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
2223

2324
class AcmeExceptionListener
2425
{
2526
public function onKernelException(GetResponseForExceptionEvent $event)
2627
{
2728
// We get the exception object from the received event
2829
$exception = $event->getException();
29-
$message = 'My Error says: ' . $exception->getMessage();
30+
$message = 'My Error says: ' . $exception->getMessage() . ' with code: ' . $exception->getCode();
3031

3132
// Customize our response object to display our exception details
3233
$response = new Response();
3334
$response->setContent($message);
34-
$response->setStatusCode($exception->getStatusCode());
35+
36+
// HttpExceptionInterface is a special type of exception that
37+
// holds status code and header details
38+
if ($exception instanceof HttpExceptionInterface) {
39+
$response->setStatusCode($exception->getStatusCode());
40+
$response->headers->replace($exception->getHeaders());
41+
} else {
42+
$response->setStatusCode(500);
43+
}
3544

3645
// Send our modified response object to the event
3746
$event->setResponse($response);

cookbook/web_services/php_soap_extension.rst

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
How to Create a SOAP Web Service in a Symfony2 Controller
55
=========================================================
66

7-
Setting up a controller to act as a SOAP server is simple with a couple
8-
tools. You must, of course, have the `PHP SOAP`_ extension installed.
9-
As the PHP SOAP extension can not currently generate a WSDL, you must either
7+
Setting up a controller to act as a SOAP server is simple with a couple
8+
tools. You must, of course, have the `PHP SOAP`_ extension installed.
9+
As the PHP SOAP extension can not currently generate a WSDL, you must either
1010
create one from scratch or use a 3rd party generator.
1111

1212
.. note::
1313

14-
There are several SOAP server implementations available for use with
15-
PHP. `Zend SOAP`_ and `NuSOAP`_ are two examples. Although we use
16-
the PHP SOAP extension in our examples, the general idea should still
14+
There are several SOAP server implementations available for use with
15+
PHP. `Zend SOAP`_ and `NuSOAP`_ are two examples. Although we use
16+
the PHP SOAP extension in our examples, the general idea should still
1717
be applicable to other implementations.
1818

1919
SOAP works by exposing the methods of a PHP object to an external entity
@@ -22,8 +22,8 @@ which represents the functionality that you'll expose in your SOAP service.
2222
In this case, the SOAP service will allow the client to call a method called
2323
``hello``, which happens to send an email::
2424

25-
// src/Acme/SoapBundle/HelloService.php
26-
namespace Acme\SoapBundle;
25+
// src/Acme/SoapBundle/Services/HelloService.php
26+
namespace Acme\SoapBundle\Services;
2727

2828
class HelloService
2929
{
@@ -58,32 +58,33 @@ a ``HelloService`` object properly:
5858

5959
.. code-block:: yaml
6060
61-
# app/config/config.yml
61+
# app/config/config.yml
6262
services:
6363
hello_service:
64-
class: Acme\DemoBundle\Services\HelloService
64+
class: Acme\SoapBundle\Services\HelloService
6565
arguments: [@mailer]
6666
6767
.. code-block:: xml
6868
6969
<!-- app/config/config.xml -->
7070
<services>
71-
<service id="hello_service" class="Acme\DemoBundle\Services\HelloService">
71+
<service id="hello_service" class="Acme\SoapBundle\Services\HelloService">
7272
<argument type="service" id="mailer"/>
7373
</service>
7474
</services>
7575
76-
Below is an example of a controller that is capable of handling a SOAP
77-
request. If ``indexAction()`` is accessible via the route ``/soap``, then the
76+
Below is an example of a controller that is capable of handling a SOAP
77+
request. If ``indexAction()`` is accessible via the route ``/soap``, then the
7878
WSDL document can be retrieved via ``/soap?wsdl``.
7979

8080
.. code-block:: php
8181
8282
namespace Acme\SoapBundle\Controller;
8383
8484
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
85+
use Symfony\Component\HttpFoundation\Response;
8586
86-
class HelloServiceController extends Controller
87+
class HelloServiceController extends Controller
8788
{
8889
public function indexAction()
8990
{
@@ -101,17 +102,17 @@ WSDL document can be retrieved via ``/soap?wsdl``.
101102
}
102103
}
103104
104-
Take note of the calls to ``ob_start()`` and ``ob_get_clean()``. These
105-
methods control `output buffering`_ which allows you to "trap" the echoed
105+
Take note of the calls to ``ob_start()`` and ``ob_get_clean()``. These
106+
methods control `output buffering`_ which allows you to "trap" the echoed
106107
output of ``$server->handle()``. This is necessary because Symfony expects
107108
your controller to return a ``Response`` object with the output as its "content".
108109
You must also remember to set the "Content-Type" header to "text/xml", as
109-
this is what the client will expect. So, you use ``ob_start()`` to start
110-
buffering the STDOUT and use ``ob_get_clean()`` to dump the echoed output
111-
into the content of the Response and clear the output buffer. Finally, you're
110+
this is what the client will expect. So, you use ``ob_start()`` to start
111+
buffering the STDOUT and use ``ob_get_clean()`` to dump the echoed output
112+
into the content of the Response and clear the output buffer. Finally, you're
112113
ready to return the ``Response``.
113114

114-
Below is an example calling the service using `NuSOAP`_ client. This example
115+
Below is an example calling the service using `NuSOAP`_ client. This example
115116
assumes that the ``indexAction`` in the controller above is accessible via the
116117
route ``/soap``::
117118

reference/constraints/Collection.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ The ``Collection`` constraint allows you to validate the different keys of
3131
a collection individually. Take the following example::
3232

3333
namespace Acme\BlogBundle\Entity;
34-
34+
3535
class Author
3636
{
3737
protected $profileData = array(
@@ -63,7 +63,7 @@ blank but is no longer than 100 characters in length, you would do the following
6363
- MaxLength:
6464
limit: 100
6565
message: Your short bio is too long!
66-
allowMissingfields: true
66+
allowMissingFields: true
6767
6868
.. code-block:: php-annotations
6969
@@ -84,7 +84,7 @@ blank but is no longer than 100 characters in length, you would do the following
8484
* )
8585
* }
8686
* },
87-
* allowMissingfields = true
87+
* allowMissingFields = true
8888
* )
8989
*/
9090
protected $profileData = array(
@@ -199,4 +199,4 @@ missingFieldsMessage
199199
**type**: ``Boolean`` **default**: ``The fields {{ fields }} are missing``
200200

201201
The message shown if `allowMissingFields`_ is false and one or more fields
202-
are missing from the underlying collection.
202+
are missing from the underlying collection.

reference/forms/types/collection.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ your form):
114114

115115
.. code-block:: html
116116

117-
<input type="email" id="form_emails_1" name="form[emails][0]" value="foo@foo.com" />
117+
<input type="email" id="form_emails_0" name="form[emails][0]" value="foo@foo.com" />
118118
<input type="email" id="form_emails_1" name="form[emails][1]" value="bar@bar.com" />
119119

120120
To allow your user to add another email, just set `allow_add`_ to ``true``

0 commit comments

Comments
 (0)
0