Skip to content

Commit a45a393

Browse files
committed
Merge branch '2.7' into 2.8
2 parents 464b578 + e2fd204 commit a45a393

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+838
-311
lines changed

best_practices/creating-the-project.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ Symfony documentation uses the AppBundle name.
110110
There is no need to prefix the AppBundle with your own vendor (e.g.
111111
AcmeAppBundle), because this application bundle is never going to be
112112
shared.
113+
114+
.. note::
115+
116+
Another reason to create a new bundle is when you're overriding something
117+
in a vendor's bundle (e.g. a controller). See :doc:`/cookbook/bundles/inheritance`.
113118

114119
All in all, this is the typical directory structure of a Symfony application
115120
that follows these best practices:

book/doctrine.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,8 @@ to the given ``Category`` object via their ``category_id`` value.
12041204
$category = $product->getCategory();
12051205

12061206
// prints "Proxies\AppBundleEntityCategoryProxy"
1207-
echo get_class($category);
1207+
dump(get_class($category));
1208+
die();
12081209

12091210
This proxy object extends the true ``Category`` object, and looks and
12101211
acts exactly like it. The difference is that, by using a proxy object,

book/service_container.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,11 @@ The service container is built using a single configuration resource
276276
be imported from inside this file in one way or another. This gives you absolute
277277
flexibility over the services in your application.
278278

279-
External service configuration can be imported in two different ways. The
280-
first - and most common method - is via the ``imports`` directive. Later, you'll
281-
learn about the second method, which is the flexible and preferred method
282-
for importing service configuration from third-party bundles.
279+
External service configuration can be imported in two different ways. The first
280+
method, commonly used to import container configuration from the bundles you've
281+
created - is via the ``imports`` directive. The second method, although slightly more
282+
complex offers more flexibility and is commonly used to import third-party bundle
283+
configuration. Read on to learn more about both methods.
283284

284285
.. index::
285286
single: Service Container; Imports

book/translation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ wrapping each with a function capable of translating the text (or "message")
1212
into the language of the user::
1313

1414
// text will *always* print out in English
15-
echo 'Hello World';
15+
dump('Hello World');
16+
die();
1617

1718
// text can be translated into the end-user's language or
1819
// default to English
19-
echo $translator->trans('Hello World');
20+
dump($translator->trans('Hello World'));
21+
die();
2022

2123
.. note::
2224

components/class_loader/class_map_generator.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ method::
5050

5151
use Symfony\Component\ClassLoader\ClassMapGenerator;
5252

53-
print_r(ClassMapGenerator::createMap(__DIR__.'/library'));
53+
var_dump(ClassMapGenerator::createMap(__DIR__.'/library'));
5454

5555
Given the files and class from the table above, you should see an output like
5656
this:

components/console/console_arguments.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Have a look at the following command that has three options::
1414

1515
use Symfony\Component\Console\Command\Command;
1616
use Symfony\Component\Console\Input\InputArgument;
17+
use Symfony\Component\Console\Input\InputDefinition;
1718
use Symfony\Component\Console\Input\InputInterface;
1819
use Symfony\Component\Console\Input\InputOption;
1920
use Symfony\Component\Console\Output\OutputInterface;

components/console/helpers/table.rst

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,25 @@ To display a table, use :class:`Symfony\\Component\\Console\\Helper\\Table`,
2121
set the headers, set the rows and then render the table::
2222

2323
use Symfony\Component\Console\Helper\Table;
24-
25-
$table = new Table($output);
26-
$table
27-
->setHeaders(array('ISBN', 'Title', 'Author'))
28-
->setRows(array(
29-
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
30-
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
31-
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
32-
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
33-
))
34-
;
35-
$table->render();
24+
// ...
25+
26+
class SomeCommand extends Command
27+
{
28+
public function execute(InputInterface $input, OutputInterface $output)
29+
{
30+
$table = new Table($output);
31+
$table
32+
->setHeaders(array('ISBN', 'Title', 'Author'))
33+
->setRows(array(
34+
array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'),
35+
array('9971-5-0210-0', 'A Tale of Two Cities', 'Charles Dickens'),
36+
array('960-425-059-0', 'The Lord of the Rings', 'J. R. R. Tolkien'),
37+
array('80-902734-1-6', 'And Then There Were None', 'Agatha Christie'),
38+
))
39+
;
40+
$table->render();
41+
}
42+
}
3643

3744
You can add a table separator anywhere in the output by passing an instance of
3845
:class:`Symfony\\Component\\Console\\Helper\\TableSeparator` as a row::

components/console/introduction.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ level of verbosity.
200200
It is possible to print a message in a command for only a specific verbosity
201201
level. For example::
202202

203-
if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
203+
if ($output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE) {
204204
$output->writeln(...);
205205
}
206206

components/console/logger.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ The association between the log level and the verbosity can be configured
8080
through the second parameter of the :class:`Symfony\\Component\\Console\\ConsoleLogger`
8181
constructor::
8282

83+
use Psr\Log\LogLevel;
8384
// ...
85+
8486
$verbosityLevelMap = array(
8587
LogLevel::NOTICE => OutputInterface::VERBOSITY_NORMAL,
8688
LogLevel::INFO => OutputInterface::VERBOSITY_NORMAL,

components/css_selector.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ equivalents::
5151

5252
use Symfony\Component\CssSelector\CssSelector;
5353

54-
print CssSelector::toXPath('div.item > h4 > a');
54+
var_dump(CssSelector::toXPath('div.item > h4 > a'));
5555

5656
This gives the following output:
5757

0 commit comments

Comments
 (0)