Skip to content

Commit 51deb99

Browse files
committed
Merge branch 'master' of git://github.com/symfony/symfony-docs.git into docs_fix
2 parents bf1a4a6 + 18f32f2 commit 51deb99

19 files changed

+406
-99
lines changed

contributing/community/index.rst

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Contributing Code
2+
=================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
7+
irc
8+
other

contributing/community/irc.rst

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
IRC Meetings
2+
============
3+
4+
The purpose of this meeting is to discuss topics in real time with many of the
5+
Symfony2 devs.
6+
7+
Anyone may propose topics on the `symfony-dev`_ mailing-list until 24 hours
8+
before the meeting, ideally including well prepared relevant information via
9+
some URL. 24 hours before the meeting a link to a `doodle`_ will be posted
10+
including a list of all proposed topics. Anyone can vote on the topics until
11+
the beginning of the meeting to define the order in the agenda. Each topic
12+
will be timeboxed to 15mins and the meeting lasts one hour, leaving enough
13+
time for at least 4 topics.
14+
15+
.. caution::
16+
17+
Note that its not the expected goal of them meeting to find final
18+
solutions, but more to ensure that there is a common understanding of the
19+
issue at hand and move the discussion forward in ways which are hard to
20+
achieve with less real time communication tools.
21+
22+
Meetings will happen each Thursday at 17:00 CET (+01:00) on the #symfony-dev
23+
channel on the Freenode IRC server.
24+
25+
The IRC `logs`_ will later be published on the trac wiki, which will include a
26+
short summary for each of the topics. Tickets will be created for any tasks or
27+
issues identified during the meeting and referenced in the summary.
28+
29+
Some simple guidelines and pointers for participation:
30+
31+
* It's possible to change votes until the beginning of the meeting by clicking
32+
on "Edit an entry";
33+
* The doodle will be closed for voting at the beginning of the meeting;
34+
* Agenda is defined by which topics got the most votes in the doodle, or
35+
whichever was proposed first in case of a tie;
36+
* At the beginning of the meeting one person will identify him/herself as the
37+
moderator;
38+
* The moderator is essentially responsible for ensuring the 15min timebox and
39+
ensuring that tasks are clearly identified;
40+
* Usually the moderator will also handle writing the summary and creating trac
41+
tickets unless someone else steps up;
42+
* Anyone can join and is explicitly invited to participate;
43+
* Ideally one should familiarize oneself with the proposed topic before the
44+
meeting;
45+
* When starting on a new topic the proposer is invited to start things off
46+
with a few words;
47+
* Anyone can then comment as they see fit;
48+
* Depending on how many people participate one should potentially retrain
49+
oneself from pushing a specific argument too hard;
50+
* Remember the IRC `logs`_ will be published later on, so people have the
51+
chance to review comments later on once more;
52+
* People are encouraged to raise their hand to take on tasks defined during
53+
the meeting.
54+
55+
Here is an `example`_ doodle.
56+
57+
.. _symfony-dev: http://groups.google.com/group/symfony-devs
58+
.. _doodle: http://doodle.com
59+
.. _logs: http://trac.symfony-project.org/wiki/Symfony2IRCMeetingLogs
60+
.. _example: http://doodle.com/4cnzme7xys3ay53w

contributing/community/other.rst

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Other Resources
2+
===============
3+
4+
In order to follow what is happening in the community you might find these additional resources helpful
5+
6+
* List of open `pulls`_ requests
7+
* List of recent `commits`_ list
8+
* List of open `bugs`_
9+
* List of open source `bundles`_
10+
11+
.. _pulls: https://github.com/fabpot/symfony/pulls
12+
.. _commits: https://github.com/fabpot/symfony/commits/master
13+
.. _bugs: http://trac.symfony-project.org/report/24
14+
.. _bundles: http://symfony2bundles.org/

contributing/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ Contribute to Symfony2:
88

99
code/index
1010
documentation/index
11+
community/index
1112

1213
.. include:: map.rst.inc

contributing/map.rst.inc

+5
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,8 @@
1313
* :doc:`Format </contributing/documentation/format>` |
1414
* :doc:`Translations </contributing/documentation/translations>` |
1515
* :doc:`License </contributing/documentation/license>`
16+
17+
* **Community**:
18+
19+
* :doc:`IRC Meetings </contributing/community/irc>` |
20+
* :doc:`Other Resources </contributing/community/other>`

guides/doctrine/orm/overview.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ write mapping information with annotations, XML, or YAML:
9898
9999
.. code-block:: yaml
100100
101-
# Application/HelloBundle/Resources/config/doctrine/metadata/orm/entities.yml
101+
# Application/HelloBundle/Resources/config/doctrine/metadata/orm/Application.HelloBundle.Entity.User.dcm.yml
102102
Application\HelloBundle\Entity\User:
103103
type: entity
104104
table: user
@@ -114,7 +114,7 @@ write mapping information with annotations, XML, or YAML:
114114
115115
.. code-block:: xml
116116
117-
<!-- Application/HelloBundle/Resources/config/doctrine/metadata/orm/entities.xml -->
117+
<!-- Application/HelloBundle/Resources/config/doctrine/metadata/orm/Application.HelloBundle.Entity.User.dcm.xml -->
118118
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
119119
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
120120
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping

guides/internals/profiler.rst

+63
Original file line numberDiff line numberDiff line change
@@ -414,3 +414,66 @@ configuration, and tag it with ``data_collector``:
414414
;
415415
416416
.. _data collectors: http://api.symfony-reloaded.org/PR3/index.html?q=DataCollector
417+
418+
Adding Web Profiler Templates
419+
-----------------------------
420+
421+
When you want to display the data collected by your Data Collector in the web
422+
debug toolbar or the web profiler, create a Twig template following this
423+
skeleton:
424+
425+
.. code-block:: jinja
426+
427+
{% extends 'WebProfilerBundle:Profiler:layout.twig' %}
428+
429+
{% block toolbar %}
430+
{# the web debug toolbar content #}
431+
{% endblock %}
432+
433+
{% block head %}
434+
{# if the web profiler panel needs some specific JS or CSS files #}
435+
{% endblock %}
436+
437+
{% block menu %}
438+
{# the menu content #}
439+
{% endblock %}
440+
441+
{% block panel %}
442+
{# the panel content #}
443+
{% endblock %}
444+
445+
Each block is optional. The ``toolbar`` block is used for the web debug
446+
toolbar and ``menu`` and ``panel`` are used to add a panel to the web
447+
profiler.
448+
449+
All blocks have access to the ``collector`` object.
450+
451+
To enable the template, register it in your configuration:
452+
453+
.. configuration-block::
454+
455+
.. code-block:: yaml
456+
457+
webprofiler.config:
458+
toolbar: true
459+
intercept_redirects: true
460+
templates:
461+
mydata: YourBundle:Profiler:mydata
462+
463+
.. code-block:: xml
464+
465+
<webprofiler:config toolbar="true" intercept-redirects="true">
466+
<webprofiler:templates
467+
mydata="YourBundle:Profiler:mydata"
468+
/>
469+
</webprofiler:config>
470+
471+
.. code-block:: php
472+
473+
$container->loadFromExtension('webprofiler', 'config', array(
474+
'toolbar' => true,
475+
'intercept-redirects' => true,
476+
'templates' => array(
477+
'mydata' => 'YourBundle:Profiler:mydata',
478+
),
479+
));

guides/templating/Twig.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ And here is a typical layout:
4343
.. code-block:: jinja
4444
4545
{# src/Application/HelloBundle/Resources/views/layout.twig #}
46-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
46+
<!DOCTYPE html>
4747
<html>
4848
<head>
4949
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

guides/validator/constraints.rst

+50-4
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ of a class ``Author`` to have at least 3 characters.
7979
</property>
8080
</class>
8181
82-
.. code-block:: php
82+
.. code-block:: php-annotations
8383
8484
// Application/HelloBundle/Author.php
8585
class Author
@@ -94,7 +94,28 @@ of a class ``Author`` to have at least 3 characters.
9494
* @validation:NotBlank()
9595
* @validation:MinLength(3)
9696
*/
97+
private $lastName;
98+
}
99+
100+
.. code-block:: php
101+
102+
// Application/HelloBundle/Author.php
103+
use Symfony\Components\Validator\Constraints\NotBlank;
104+
use Symfony\Components\Validator\Constraints\MinLength;
105+
106+
class Author
107+
{
97108
private $firstName;
109+
110+
private $lastName;
111+
112+
public static function loadMetadata(ClassMetadata $metadata)
113+
{
114+
$metadata->addPropertyConstraint('firstName', new NotBlank());
115+
$metadata->addPropertyConstraint('firstName', new MinLength(3));
116+
$metadata->addPropertyConstraint('lastName', new NotBlank());
117+
$metadata->addPropertyConstraint('lastName', new MinLength(3));
118+
}
98119
}
99120
100121
Getters
@@ -133,7 +154,7 @@ generated token is correct:
133154
</getter>
134155
</class>
135156
136-
.. code-block:: php
157+
.. code-block:: php-annotations
137158
138159
// Application/HelloBundle/Author.php
139160
class Author
@@ -147,6 +168,27 @@ generated token is correct:
147168
}
148169
}
149170
171+
.. code-block:: php
172+
173+
// Application/HelloBundle/Author.php
174+
use Symfony\Components\Validator\Constraints\AssertTrue;
175+
176+
class Author
177+
{
178+
179+
public static function loadMetadata(ClassMetadata $metadata)
180+
{
181+
$metadata->addGetterConstraint('tokenValid', new AssertTrue(array(
182+
'message' => 'The token is invalid',
183+
)));
184+
}
185+
186+
public function isTokenValid()
187+
{
188+
// return true or false
189+
}
190+
}
191+
150192
.. note::
151193

152194
The keen-eyed among you will have noticed that the prefix of the getter
@@ -161,7 +203,9 @@ You can create a custom constraint by extending the base constraint class,
161203
:class:`Symfony\\Component\\Validator\\Constraint`. Options for your
162204
constraint are represented by public properties on the constraint class. For
163205
example, the ``Url`` constraint includes ``message`` and ``protocols``
164-
properties::
206+
properties:
207+
208+
.. code-block:: php
165209
166210
namespace Symfony\Component\Validator\Constraints;
167211
@@ -174,7 +218,9 @@ properties::
174218
As you can see, a constraint class is fairly minimal. The actual validation is
175219
performed by a another "constraint validator" class. Which constraint
176220
validator is specified by the constraint's ``validatedBy()`` method, which
177-
includes some simple default logic::
221+
includes some simple default logic:
222+
223+
.. code-block:: php
178224
179225
// in the base Symfony\Component\Validator\Constraint class
180226
public function validatedBy()

guides/validator/constraints/AssertTrue.rst

+23-3
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ Then you can constrain this method with ``AssertTrue``.
5656
</getter>
5757
</class>
5858
59-
.. code-block:: php
59+
.. code-block:: php-annotations
6060
6161
// Application/HelloBundle/Author.php
62-
namespace Application\HelloBundle;
63-
6462
class Author
6563
{
6664
protected $token;
@@ -74,6 +72,28 @@ Then you can constrain this method with ``AssertTrue``.
7472
}
7573
}
7674
75+
.. code-block:: php
76+
77+
// Application/HelloBundle/Author.php
78+
use Symfony\Components\Validator\Constraints\AssertTrue;
79+
80+
class Author
81+
{
82+
protected $token;
83+
84+
public static function loadMetadata(ClassMetadata $metadata)
85+
{
86+
$metadata->addGetterConstraint('tokenValid', new AssertTrue(array(
87+
'message' => 'The token is invalid',
88+
)));
89+
}
90+
91+
public function isTokenValid()
92+
{
93+
return $this->token == $this->generateToken();
94+
}
95+
}
96+
7797
If the validation of this method fails, you will see a message similar to
7898
this:
7999

guides/validator/constraints/Choice.rst

+18-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ constraint definition as array.
5151
</property>
5252
</class>
5353
54-
.. code-block:: php
54+
.. code-block:: php-annotations
5555
5656
// Application/HelloBundle/Author.php
5757
class Author
@@ -62,6 +62,21 @@ constraint definition as array.
6262
protected $gender;
6363
}
6464
65+
.. code-block:: php
66+
67+
// Application/HelloBundle/Author.php
68+
use Symfony\Components\Validator\Constraints\Choice;
69+
70+
class Author
71+
{
72+
protected $gender;
73+
74+
public static function loadMetadata(ClassMetadata $metadata)
75+
{
76+
$metadata->addPropertyConstraint('gender', new Choice(array('male', 'female')));
77+
}
78+
}
79+
6580
Example 2: Choices from a callback
6681
----------------------------------
6782

@@ -104,7 +119,7 @@ constraint.
104119
</property>
105120
</class>
106121
107-
.. code-block:: php
122+
.. code-block:: php-annotations
108123
109124
// Application/HelloBundle/Author.php
110125
class Author
@@ -142,7 +157,7 @@ you can pass the class name and the method as array.
142157
</property>
143158
</class>
144159
145-
.. code-block:: php
160+
.. code-block:: php-annotations
146161
147162
// Application/HelloBundle/Author.php
148163
class Author

0 commit comments

Comments
 (0)