Permalink
Browse files

minor #3553 Minimize horizontal scrolling in code blocks to improve r…

…eadability (ifdattic)

This PR was merged into the 2.3 branch.

Discussion
----------

Minimize horizontal scrolling in code blocks to improve readability

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

Commits
-------

473969f Minimize horizontal scrolling in code blocks to improve readability
  • Loading branch information...
weaverryan committed Feb 18, 2014
2 parents 5120863 + 473969f commit 15d8ab892168efacb34c53b22b222ef669e90897
View
@@ -508,7 +508,10 @@ value to each variable.
$subRequest = $request->duplicate(array(), null, $path);
$httpKernel = $this->container->get('http_kernel');
$response = $httpKernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST);
$response = $httpKernel->handle(
$subRequest,
HttpKernelInterface::SUB_REQUEST
);
.. index::
single: Controller; Rendering templates
@@ -574,7 +577,8 @@ The Symfony templating engine is explained in great detail in the
'AcmeHelloBundle:Hello/Greetings:index.html.twig',
array('name' => $name)
);
// index.html.twig found in Resources/views/Hello/Greetings is rendered.
// index.html.twig found in Resources/views/Hello/Greetings
// is rendered.
.. index::
single: Controller; Accessing services
View
@@ -622,8 +622,10 @@ Once you have your repository, you have access to all sorts of helpful methods::
You can also take advantage of the useful ``findBy`` and ``findOneBy`` methods
to easily fetch objects based on multiple conditions::
// query for one product matching by name and price
$product = $repository->findOneBy(array('name' => 'foo', 'price' => 19.99));
// query for one product matching be name and price
$product = $repository->findOneBy(
array('name' => 'foo', 'price' => 19.99)
);
// query for all products matching the name, ordered by price
$products = $repository->findBy(
@@ -1144,7 +1146,8 @@ Now you can see this new code in action! Imagine you're inside a controller::
$em->flush();
return new Response(
'Created product id: '.$product->getId().' and category id: '.$category->getId()
'Created product id: '.$product->getId()
.' and category id: '.$category->getId()
);
}
}
@@ -1478,8 +1481,8 @@ and ``nullable``. Take a few examples:
protected $name;
/**
* A string field of length 150 that persists to an "email_address" column
* and has a unique index.
* A string field of length 150 that persists to an
* "email_address" column and has a unique index.
*
* @ORM\Column(name="email_address", unique=true, length=150)
*/
@@ -1489,13 +1492,14 @@ and ``nullable``. Take a few examples:
fields:
# A string field length 255 that cannot be null
# (reflecting the default values for the "length" and *nullable* options)
# type attribute is necessary in YAML definitions
# (reflecting the default values for the "length"
# and *nullable* options) type attribute is
# necessary in YAML definitions
name:
type: string
# A string field of length 150 that persists to an "email_address" column
# and has a unique index.
# A string field of length 150 that persists to
# an "email_address" column and has a unique index.
email:
type: string
column: email_address
@@ -1506,8 +1510,9 @@ and ``nullable``. Take a few examples:
<!--
A string field length 255 that cannot be null
(reflecting the default values for the "length" and *nullable* options)
type attribute is necessary in XML definitions
(reflecting the default values for the "length"
and *nullable* options) type attribute is
necessary in XML definitions
-->
<field name="name" type="string" />
<field name="email"
@@ -181,8 +181,10 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
$defaultFormTheme = 'form_div_layout.html.twig';
$vendorDir = realpath(__DIR__ . '/../vendor');
// the path to TwigBridge so Twig can locate the form_div_layout.html.twig file
$vendorTwigBridgeDir = $vendorDir . '/symfony/twig-bridge/Symfony/Bridge/Twig';
// the path to TwigBridge so Twig can locate the
// form_div_layout.html.twig file
$vendorTwigBridgeDir =
$vendorDir . '/symfony/twig-bridge/Symfony/Bridge/Twig';
// the path to your other templates
$viewsDir = realpath(__DIR__ . '/../views');
@@ -193,7 +195,9 @@ to bootstrap or access Twig and add the :class:`Symfony\\Bridge\\Twig\\Extension
$formEngine = new TwigRendererEngine(array($defaultFormTheme));
$formEngine->setEnvironment($twig);
// add the FormExtension to Twig
$twig->addExtension(new FormExtension(new TwigRenderer($formEngine, $csrfProvider)));
$twig->addExtension(
new FormExtension(new TwigRenderer($formEngine, $csrfProvider))
);
// create your form factory as normal
$formFactory = Forms::createFormFactoryBuilder()
@@ -307,7 +311,8 @@ Your integration with the Validation component will look something like this::
$vendorDir = realpath(__DIR__ . '/../vendor');
$vendorFormDir = $vendorDir . '/symfony/form/Symfony/Component/Form';
$vendorValidatorDir = $vendorDir . '/symfony/validator/Symfony/Component/Validator';
$vendorValidatorDir =
$vendorDir . '/symfony/validator/Symfony/Component/Validator';
// create the validator - details will vary
$validator = Validation::createValidator();
@@ -259,7 +259,8 @@ If you need to get full access to parsed data from ``Accept``, ``Accept-Language
}
// accepts items are sorted by descending quality
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))->all();
$accepts = AcceptHeader::fromString($request->headers->get('Accept'))
->all();
Accessing other Data
~~~~~~~~~~~~~~~~~~~~
@@ -432,7 +433,10 @@ abstracts the hard work behind a simple API::
use Symfony\Component\HttpFoundation\ResponseHeaderBag;
$d = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'foo.pdf');
$d = $response->headers->makeDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
'foo.pdf'
);
$response->headers->set('Content-Disposition', $d);
@@ -460,7 +464,10 @@ if it should::
You can still set the ``Content-Type`` of the sent file, or change its ``Content-Disposition``::
$response->headers->set('Content-Type', 'text/plain');
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'filename.txt');
$response->setContentDisposition(
ResponseHeaderBag::DISPOSITION_ATTACHMENT,
'filename.txt'
);
.. _component-http-foundation-json-response:
@@ -610,7 +610,9 @@ a built-in ControllerResolver that can be used to create a working example::
$routes = new RouteCollection();
$routes->add('hello', new Route('/hello/{name}', array(
'_controller' => function (Request $request) {
return new Response(sprintf("Hello %s", $request->get('name')));
return new Response(
sprintf("Hello %s", $request->get('name'))
);
}
)
));
View
@@ -282,7 +282,12 @@ multi-valued entries (arrays), the values of the more specific and the fallback
locale will be merged. In order to suppress this behavior, the last parameter
``$fallback`` can be set to ``false``::
echo $reader->readEntry('/path/to/bundle', 'en', array('Data', 'entry1'), false);
echo $reader->readEntry(
'/path/to/bundle',
'en',
array('Data', 'entry1'),
false
);
Accessing ICU Data
------------------

0 comments on commit 15d8ab8

Please sign in to comment.