Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit87b9556

Browse files
committed
Avoid scrollbars in code examples
1 parentefd7395 commit87b9556

File tree

13 files changed

+353
-126
lines changed

13 files changed

+353
-126
lines changed

‎book/controller.rst‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,7 +667,10 @@ For example, imagine you're processing a form submit::
667667
if ($form->isValid()) {
668668
// do some sort of processing
669669

670-
$this->get('session')->getFlashBag()->add('notice', 'Your changes were saved!');
670+
$this->get('session')->getFlashBag()->add(
671+
'notice',
672+
'Your changes were saved!'
673+
);
671674

672675
return $this->redirect($this->generateUrl(...));
673676
}

‎book/doctrine.rst‎

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,9 @@ just a simple PHP class.
212212

213213
..code-block::bash
214214
215-
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Product" --fields="name:string(255) price:float description:text"
215+
$ php app/console doctrine:generate:entity \
216+
--entity="AcmeStoreBundle:Product" \
217+
--fields="name:string(255) price:float description:text"
216218
217219
..index::
218220
single: Doctrine; Adding mapping metadata
@@ -696,7 +698,10 @@ a controller, do the following::
696698

697699
$em = $this->getDoctrine()->getManager();
698700
$query = $em->createQuery(
699-
'SELECT p FROM AcmeStoreBundle:Product p WHERE p.price > :price ORDER BY p.price ASC'
701+
'SELECT p
702+
FROM AcmeStoreBundle:Product p
703+
WHERE p.price > :price
704+
ORDER BY p.price ASC'
700705
)->setParameter('price', '19.99');
701706

702707
$products = $query->getResult();
@@ -858,7 +863,9 @@ ordered alphabetically.
858863
public function findAllOrderedByName()
859864
{
860865
return $this->getEntityManager()
861-
->createQuery('SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC')
866+
->createQuery(
867+
'SELECT p FROM AcmeStoreBundle:Product p ORDER BY p.name ASC'
868+
)
862869
->getResult();
863870
}
864871
}
@@ -892,7 +899,8 @@ you can let Doctrine create the class for you.
892899

893900
..code-block::bash
894901
895-
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category" --fields="name:string(255)"
902+
$ php app/console doctrine:generate:entity --entity="AcmeStoreBundle:Category"\
903+
--fields="name:string(255)"
896904
897905
This task generates the ``Category`` entity for you, with an ``id`` field,
898906
a ``name`` field and the associated getter and setter functions.
@@ -937,7 +945,7 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
937945
products:
938946
targetEntity:Product
939947
mappedBy:category
940-
# don't forget to init the collection inentity __construct() method
948+
# don't forget to init the collection inthe __construct() method of the entity
941949
942950
..code-block::xml
943951
@@ -954,7 +962,10 @@ To relate the ``Category`` and ``Product`` entities, start by creating a
954962
mapped-by="category"
955963
/>
956964
957-
<!-- don't forget to init the collection in entity __construct() method-->
965+
<!--
966+
don't forget to init the collection in
967+
the __construct() method of the entity
968+
-->
958969
</entity>
959970
</doctrine-mapping>
960971
@@ -1325,7 +1336,8 @@ the current date, only when the entity is first persisted (i.e. inserted):
13251336
<entityname="Acme\StoreBundle\Entity\Product">
13261337
<!-- ...-->
13271338
<lifecycle-callbacks>
1328-
<lifecycle-callbacktype="prePersist"method="setCreatedValue" />
1339+
<lifecycle-callbacktype="prePersist"
1340+
method="setCreatedValue" />
13291341
</lifecycle-callbacks>
13301342
</entity>
13311343
</doctrine-mapping>

‎book/forms.rst‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,10 @@ object.
344344
$metadata->addPropertyConstraint('task', new NotBlank());
345345
346346
$metadata->addPropertyConstraint('dueDate', new NotBlank());
347-
$metadata->addPropertyConstraint('dueDate', new Type('\DateTime'));
347+
$metadata->addPropertyConstraint(
348+
'dueDate',
349+
new Type('\DateTime')
350+
);
348351
}
349352
}
350353
@@ -424,7 +427,10 @@ to an array callback, or a ``Closure``::
424427
public function setDefaultOptions(OptionsResolverInterface $resolver)
425428
{
426429
$resolver->setDefaults(array(
427-
'validation_groups' => array('Acme\\AcmeBundle\\Entity\\Client', 'determineValidationGroups'),
430+
'validation_groups' => array(
431+
'Acme\AcmeBundle\Entity\Client',
432+
'determineValidationGroups',
433+
),
428434
));
429435
}
430436

@@ -903,7 +909,8 @@ easy to use in your application.
903909
..code-block::xml
904910
905911
<!-- src/Acme/TaskBundle/Resources/config/services.xml-->
906-
<serviceid="acme_demo.form.type.task"class="Acme\TaskBundle\Form\Type\TaskType">
912+
<serviceid="acme_demo.form.type.task"
913+
class="Acme\TaskBundle\Form\Type\TaskType">
907914
<tagname="form.type"alias="task" />
908915
</service>
909916
@@ -913,7 +920,10 @@ easy to use in your application.
913920
use Symfony\Component\DependencyInjection\Definition;
914921
915922
$container
916-
->register('acme_demo.form.type.task', 'Acme\TaskBundle\Form\Type\TaskType')
923+
->register(
924+
'acme_demo.form.type.task',
925+
'Acme\TaskBundle\Form\Type\TaskType'
926+
)
917927
->addTag('form.type', array(
918928
'alias' => 'task',
919929
))
@@ -1286,13 +1296,13 @@ rendered (e.g. ``label``, ``widget``, ``errors``, etc). By default, there
12861296
are 4 possible *parts* of a form that can be rendered:
12871297

12881298
+-------------+--------------------------+---------------------------------------------------------+
1289-
| ``label``| (e.g. ``form_label``)| renders the field's label|
1299+
| ``label``| (e.g. ``form_label``)| renders the field's label|
12901300
+-------------+--------------------------+---------------------------------------------------------+
1291-
| ``widget``| (e.g. ``form_widget``)| renders the field's HTML representation|
1301+
| ``widget``| (e.g. ``form_widget``)| renders the field's HTML representation|
12921302
+-------------+--------------------------+---------------------------------------------------------+
1293-
| ``errors``| (e.g. ``form_errors``)| renders the field's errors|
1303+
| ``errors``| (e.g. ``form_errors``)| renders the field's errors|
12941304
+-------------+--------------------------+---------------------------------------------------------+
1295-
| ``row``| (e.g. ``form_row``)| renders the field's entire row (label, widget & errors)|
1305+
| ``row``| (e.g. ``form_row``)| renders the field's entire row (label, widget & errors)|
12961306
+-------------+--------------------------+---------------------------------------------------------+
12971307

12981308
..note::

‎book/installation.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ Distribution:
5757

5858
..code-block::bash
5959
60-
php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0
60+
$ php composer.phar create-project \
61+
symfony/framework-standard-edition /path/to/webroot/Symfony 2.2.0
6162
6263
..tip::
6364

‎book/internals.rst‎

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,11 @@ and set a new ``Exception`` object, or do nothing::
418418
response won't work. If you want to overwrite the status code (which you
419419
should not without a good reason), set the ``X-Status-Code`` header::
420420

421-
return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200));
421+
return new Response(
422+
'Error',
423+
404 // ignored,
424+
array('X-Status-Code' => 200)
425+
);
422426

423427
..index::
424428
single: Event Dispatcher
@@ -610,11 +614,19 @@ If you enable the web profiler, you also need to mount the profiler routes:
610614
611615
..code-block::xml
612616
613-
<importresource="@WebProfilerBundle/Resources/config/routing/profiler.xml"prefix="/_profiler" />
617+
<import
618+
resource="@WebProfilerBundle/Resources/config/routing/profiler.xml"
619+
prefix="/_profiler"
620+
/>
614621
615622
..code-block::php
616623
617-
$collection->addCollection($loader->import("@WebProfilerBundle/Resources/config/routing/profiler.xml"), '/_profiler');
624+
$collection->addCollection(
625+
$loader->import(
626+
"@WebProfilerBundle/Resources/config/routing/profiler.xml"
627+
),
628+
'/_profiler'
629+
);
618630
619631
As the profiler adds some overhead, you might want to enable it only under
620632
certain circumstances in the production environment. The ``only-exceptions``
@@ -626,7 +638,8 @@ portion of the website? You can use a request matcher:
626638

627639
..code-block::yaml
628640
629-
# enables the profiler only for request coming for the 192.168.0.0 network
641+
# enables the profiler only for request coming
642+
# for the 192.168.0.0 network
630643
framework:
631644
profiler:
632645
matcher:{ ip: 192.168.0.0/24 }
@@ -641,14 +654,18 @@ portion of the website? You can use a request matcher:
641654
profiler:
642655
matcher:{ ip: 192.168.0.0/24, path: "^/admin/" }
643656
644-
# use a custom matcher instance defined in the "custom_matcher" service
657+
# use a custom matcher instance defined in
658+
# the "custom_matcher" service
645659
framework:
646660
profiler:
647661
matcher:{ service: custom_matcher }
648662
649663
..code-block::xml
650664
651-
<!-- enables the profiler only for request coming for the 192.168.0.0 network-->
665+
<!--
666+
enables the profiler only for request coming
667+
for the 192.168.0.0 network
668+
-->
652669
<framework:config>
653670
<framework:profiler>
654671
<framework:matcherip="192.168.0.0/24" />
@@ -669,7 +686,10 @@ portion of the website? You can use a request matcher:
669686
</framework:profiler>
670687
</framework:config>
671688
672-
<!-- use a custom matcher instance defined in the "custom_matcher" service-->
689+
<!--
690+
use a custom matcher instance defined in
691+
the "custom_matcher" service
692+
-->
673693
<framework:config>
674694
<framework:profiler>
675695
<framework:matcherservice="custom_matcher" />
@@ -678,7 +698,8 @@ portion of the website? You can use a request matcher:
678698
679699
..code-block::php
680700
681-
// enables the profiler only for request coming for the 192.168.0.0 network
701+
// enables the profiler only for request coming
702+
// for the 192.168.0.0 network
682703
$container->loadFromExtension('framework', array(
683704
'profiler' => array(
684705
'matcher' => array('ip' => '192.168.0.0/24'),
@@ -695,11 +716,15 @@ portion of the website? You can use a request matcher:
695716
// combine rules
696717
$container->loadFromExtension('framework', array(
697718
'profiler' => array(
698-
'matcher' => array('ip' => '192.168.0.0/24', 'path' => '^/admin/'),
719+
'matcher' => array(
720+
'ip' => '192.168.0.0/24',
721+
'path' => '^/admin/',
722+
),
699723
),
700724
));
701725
702-
# use a custom matcher instance defined in the "custom_matcher" service
726+
// use a custom matcher instance defined in
727+
// the "custom_matcher" service
703728
$container->loadFromExtension('framework', array(
704729
'profiler' => array(
705730
'matcher' => array('service' => 'custom_matcher'),

‎book/page_creation.rst‎

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,11 @@ an entry when you generated the ``AcmeHelloBundle``:
114114
115115
<routesxmlns="http://symfony.com/schema/routing"
116116
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
117-
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
117+
xsi:schemaLocation="http://symfony.com/schema/routing
118+
http://symfony.com/schema/routing/routing-1.0.xsd">
118119
119-
<importresource="@AcmeHelloBundle/Resources/config/routing.xml"prefix="/" />
120+
<importresource="@AcmeHelloBundle/Resources/config/routing.xml"
121+
prefix="/" />
120122
</routes>
121123
122124
..code-block::php
@@ -157,7 +159,8 @@ the new route that defines the URL of the page that you're about to create:
157159
158160
<routesxmlns="http://symfony.com/schema/routing"
159161
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
160-
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
162+
xsi:schemaLocation="http://symfony.com/schema/routing
163+
http://symfony.com/schema/routing/routing-1.0.xsd">
161164
162165
<routeid="hello"path="/hello/{name}">
163166
<defaultkey="_controller">AcmeHelloBundle:Hello:index</default>
@@ -771,7 +774,9 @@ format you prefer:
771774
772775
$container->loadFromExtension('framework', array(
773776
'secret' => '%secret%',
774-
'router' => array('resource' => '%kernel.root_dir%/config/routing.php'),
777+
'router' => array(
778+
'resource' => '%kernel.root_dir%/config/routing.php',
779+
),
775780
// ...
776781
),
777782
));
@@ -940,7 +945,9 @@ the configuration file for the ``dev`` environment.
940945
</imports>
941946
942947
<framework:config>
943-
<framework:routerresource="%kernel.root_dir%/config/routing_dev.xml" />
948+
<framework:router
949+
resource="%kernel.root_dir%/config/routing_dev.xml"
950+
/>
944951
<framework:profileronly-exceptions="false" />
945952
</framework:config>
946953
@@ -952,7 +959,9 @@ the configuration file for the ``dev`` environment.
952959
$loader->import('config.php');
953960
954961
$container->loadFromExtension('framework', array(
955-
'router' => array('resource' => '%kernel.root_dir%/config/routing_dev.php'),
962+
'router' => array(
963+
'resource' => '%kernel.root_dir%/config/routing_dev.php',
964+
),
956965
'profiler' => array('only-exceptions' => false),
957966
));
958967

‎book/performance.rst‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ as comments in this file::
7979
$loader = require_once __DIR__.'/../app/bootstrap.php.cache';
8080

8181
// Use APC for autoloading to improve performance
82-
// Change 'sf2' by the prefix you want in order to prevent key conflict with another application
82+
// Change 'sf2' by the prefix you want in order
83+
// to prevent key conflict with another application
8384
/*
8485
$loader = new ApcClassLoader('sf2', $loader);
8586
$loader->register(true);

‎book/propel.rst‎

Lines changed: 32 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -304,22 +304,46 @@ Start by adding the ``category`` definition in your ``schema.xml``:
304304

305305
..code-block::xml
306306
307-
<databasename="default"namespace="Acme\StoreBundle\Model"defaultIdMethod="native">
307+
<databasename="default"
308+
namespace="Acme\StoreBundle\Model"
309+
defaultIdMethod="native">
308310
<tablename="product">
309-
<columnname="id"type="integer"required="true"primaryKey="true"autoIncrement="true" />
310-
<columnname="name"type="varchar"primaryString="true"size="100" />
311-
<columnname="price"type="decimal" />
312-
<columnname="description"type="longvarchar" />
311+
<columnname="id"
312+
type="integer"
313+
required="true"
314+
primaryKey="true"
315+
autoIncrement="true" />
316+
317+
<columnname="name"
318+
type="varchar"
319+
primaryString="true"
320+
size="100" />
321+
322+
<columnname="price"
323+
type="decimal" />
324+
325+
<columnname="description"
326+
type="longvarchar" />
327+
328+
<columnname="category_id"
329+
type="integer" />
313330
314-
<columnname="category_id"type="integer" />
315331
<foreign-keyforeignTable="category">
316332
<referencelocal="category_id"foreign="id" />
317333
</foreign-key>
318334
</table>
319335
320336
<tablename="category">
321-
<columnname="id"type="integer"required="true"primaryKey="true"autoIncrement="true" />
322-
<columnname="name"type="varchar"primaryString="true"size="100" />
337+
<columnname="id"
338+
type="integer"
339+
required="true"
340+
primaryKey="true"
341+
autoIncrement="true" />
342+
343+
<columnname="name"
344+
type="varchar"
345+
primaryString="true"
346+
size="100" />
323347
</table>
324348
</database>
325349

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp