Skip to content

Tweaking Doctrine book chapter #3488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 270 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
270 commits
Select commit Hold shift + click to select a range
0e843ff
Merge branch '2.3'
weaverryan Jun 22, 2013
7038693
Merge branch '2.3'
weaverryan Jun 22, 2013
ff2e2c4
Merge branch '2.3'
weaverryan Jun 29, 2013
ca1a38d
Merge branch '2.3'
weaverryan Jun 29, 2013
1f78980
[#2720] Playing "catch-up" to get the master branch up to date with t…
weaverryan Jun 29, 2013
d7da8a5
Merge pull request #2784 from symfony/version-catchup
weaverryan Jun 29, 2013
28d51a9
Merge pull request #2642 from mpartel/progresshelper-clear
weaverryan Jun 30, 2013
40f407d
Merge branch '2.3'
weaverryan Jul 1, 2013
07341ba
Merge remote-tracking branch 'origin/master'
weaverryan Jul 1, 2013
84d569d
Merge branch '2.3'
weaverryan Jul 19, 2013
d633094
Merge branch '2.3'
weaverryan Jul 20, 2013
f897411
[#2797] Removing the 2.1 version notes on master (since 2.1 has been …
weaverryan Jul 20, 2013
95e651f
Merge branch '2.3'
weaverryan Jul 20, 2013
f57b569
[#2829] Changing reference back to master - eventually we'll need an …
weaverryan Jul 20, 2013
d3b0a38
Merge branch '2.3'
weaverryan Jul 20, 2013
b414088
Merge branch '2.3'
weaverryan Jul 20, 2013
92a9437
Merge branch '2.3'
weaverryan Jul 29, 2013
d0d7c47
Merge branch '2.3'
weaverryan Jul 29, 2013
c80e4e7
[#2783] Removing 2.1 versionadded that came back due to a tweak on th…
weaverryan Jul 29, 2013
b6d5606
Updated rounding_mode documentation to reflect changed ROUND_ constants.
webmozart Aug 1, 2013
2e25e00
adds docs for idle timeout (see symfony/symfony#8651)
schmittjoh Aug 4, 2013
3fa71b8
adds api link
schmittjoh Aug 4, 2013
e1cf110
Merge pull request #2875 from schmittjoh/patch-2
weaverryan Aug 4, 2013
1891edd
Updated documentation for PR https://github.com/symfony/symfony/pull/…
Jul 21, 2013
e797af3
Merge branch '2.3'
weaverryan Aug 5, 2013
fc8a060
Merge branch '2.3'
weaverryan Aug 8, 2013
871b340
Merge remote-tracking branch 'origin/master'
weaverryan Aug 8, 2013
8b0611a
[Process] Update docs for modifications.
Aug 9, 2013
d695cad
Merge branch '2.3'
weaverryan Aug 10, 2013
6f0c697
Merge pull request #2840 from lmammino/improved-image-validator
weaverryan Aug 10, 2013
8e6f084
[#2840] Minor tweaks to new orientation Image validation constraints
weaverryan Aug 10, 2013
03aaa5c
Document possibility to use ContainerAwareTrait
endroid Aug 11, 2013
76e460d
Merge pull request #2630 from WouterJ/document_stopwatch_helper
weaverryan Aug 17, 2013
3d27f53
[#2630] Tweaks for new stopwatch tag - updating version, syntax for u…
weaverryan Aug 17, 2013
5471a32
Merge branch '2.3'
weaverryan Aug 17, 2013
c6e50b7
Removing several "2.1" references, which is consistent with our relea…
weaverryan Aug 17, 2013
0dfcdf7
Merge branch '2.3'
weaverryan Aug 17, 2013
0c2f735
Merge pull request #2872 from bschussek/issue8473
weaverryan Aug 25, 2013
69be273
Merge branch '2.3'
weaverryan Aug 26, 2013
a801c09
Improve documentation of ContentAwareTrait
endroid Aug 27, 2013
066fcd5
Added docs for the changes proposed in symfony/symfony#8908
ChristianGaertner Sep 1, 2013
7afa87f
Update filesystem.rst
ChristianGaertner Sep 1, 2013
feb346d
Update filesystem.rst
ChristianGaertner Sep 1, 2013
d9050a5
added documentation for the new request_stack service
fabpot Sep 8, 2013
7ed82a0
Merge branch '2.3'
weaverryan Sep 9, 2013
f1ab2ad
Merge branch '2.3'
weaverryan Sep 9, 2013
3780933
Documented Stopwatch Helper
wouterj Sep 10, 2013
3548a51
Merge pull request #2956 from fabpot/request-stack
weaverryan Sep 12, 2013
b84f52c
[#2956] A few more changes to the scopes chapter to update the new wa…
weaverryan Sep 12, 2013
67901ff
document the getEncodings() method of the Request class
xabbuh Sep 12, 2013
5f69c8f
Merge branch '2.3'
weaverryan Sep 13, 2013
1112cc2
Merge branch 'patch-1' of github.com:endroid/symfony-docs into endroi…
weaverryan Sep 18, 2013
3210251
[#2891] Shortening note about ContainerAwareTrait
weaverryan Sep 18, 2013
a7e86b0
Merge branch '2.3'
weaverryan Sep 23, 2013
6be4f80
Merge branch '2.3'
weaverryan Sep 25, 2013
9a715ed
Merge branch '2.3'
weaverryan Sep 25, 2013
887f0d2
Updated the documentation for the simplified Callback constraint
webmozart Sep 26, 2013
cc70738
Merge branch '2.3'
weaverryan Sep 26, 2013
893a780
[#3009] Updating information for 2.4 with the new checkPasswordLength…
weaverryan Sep 26, 2013
c8dfa9e
Merge branch '2.3'
weaverryan Sep 28, 2013
574d7a8
[#2913] Removing versionadded 2.1 messages from the master branch
weaverryan Sep 28, 2013
a866606
Add a cookbook entry on how to limit session metadata writes
adrienbrault Sep 27, 2013
0e9f02a
added documentation about Request::setFactory()
fabpot Sep 30, 2013
16799b4
added the compact layout information
fabpot Oct 2, 2013
81698fe
Merge pull request #2947 from ChristianGaertner/patch-1
weaverryan Oct 2, 2013
7e0cb8b
[#2947] Adding versionadded details
weaverryan Oct 2, 2013
0f674c1
Merge pull request #2960 from WouterJ/doc_php_stopwatch
weaverryan Oct 2, 2013
2be6510
[#2960] Minor changes thanks to @xabbuh
weaverryan Oct 2, 2013
6a13396
Merge pull request #2728 from imobilis/ticket_7884
weaverryan Oct 2, 2013
88f051a
[#2728] Minor tweaks to docs on Process flush methods
weaverryan Oct 2, 2013
32c510f
Merge pull request #2971 from xabbuh/issue-2958
weaverryan Oct 2, 2013
66f1672
[#2971] Minor language tweak to be consistent with the other areas
weaverryan Oct 2, 2013
d4f9478
Merge branch '2.3'
weaverryan Oct 2, 2013
e52ac5c
fix versionadded directive
xabbuh Oct 4, 2013
4732a76
[#2728] Fixing typo thanks to @xabbuh
weaverryan Oct 5, 2013
022763a
Merge pull request #3036 from xabbuh/fix-build-errors-master
weaverryan Oct 5, 2013
adcef55
Merge branch '2.3'
weaverryan Oct 5, 2013
5aa3a19
Merge pull request #3021 from fabpot/request-factory
weaverryan Oct 6, 2013
1d94f34
[#3021] Minor tweaks thanks to @WouterJ and @GromNaN
weaverryan Oct 6, 2013
cab5c89
Creates Expression Language chapter
wouterj Oct 6, 2013
27822ff
Bootstraps intro
wouterj Oct 6, 2013
efe349e
use literal for class name
xabbuh Oct 6, 2013
6631f70
Added operators
wouterj Oct 6, 2013
4ff9fae
Added another operator
wouterj Oct 6, 2013
f98fa24
Register Commands in the Service Container
lyrixx Oct 4, 2013
cfee7b8
Merge pull request #3043 from xabbuh/patch-1
weaverryan Oct 7, 2013
b1478f3
Merge branch '2.3'
weaverryan Oct 7, 2013
9b04e53
Merge branch 'issue2480' of github.com:bschussek/symfony-docs into bs…
weaverryan Oct 8, 2013
b94e3f7
[#3012] Tweaks to Callback changes - most thanks to the careful eye o…
weaverryan Oct 8, 2013
3efd179
[Form] Add a 'submitted' attribute to the form view
GeLoLabs Oct 3, 2013
ca83f6a
Documents Output::*Verbose methods
lyrixx Oct 8, 2013
9268e3a
Merge pull request #3025 from fabpot/console-compact-layout
weaverryan Oct 10, 2013
26b2e9f
Merge branch '2.3'
weaverryan Oct 10, 2013
22a270e
Merge pull request #3017 from adrienbrault/session-metadata
weaverryan Oct 10, 2013
bdd37ba
[#3017] Very minor tweaks
weaverryan Oct 10, 2013
ce45928
make target name unique that is used as a reference
xabbuh Oct 10, 2013
808319d
Merge pull request #3029 from egeloen/f-valid-form-view
weaverryan Oct 14, 2013
7e7425c
Merge pull request #3031 from lyrixx/command-in-the-DIC
weaverryan Oct 14, 2013
0925090
[#3031] Adding some details as to why you may or may not want to regi…
weaverryan Oct 14, 2013
4009c51
Merge branch '2.3'
weaverryan Oct 14, 2013
0c34aa1
Merge pull request #3048 from lyrixx/console-ouput-verbosity
weaverryan Oct 15, 2013
a53c8ad
[#3048] Adding intro paragraph about the semantic verbosity methods
weaverryan Oct 15, 2013
72b690f
[#3031] Fixing typo thanks to @xabbuh
weaverryan Oct 15, 2013
b944124
Added documentation about disabling internal validation of DomCrawler…
pylebecq Oct 20, 2013
b02bc8c
add note about not passing the command argument with Symfony 2.4
xabbuh Oct 22, 2013
8fe9fd6
Fixed comments and splitted in intro and syntax
wouterj Oct 26, 2013
85fce13
Merge pull request #3058 from xabbuh/fix-build-errors
weaverryan Oct 26, 2013
e874269
Merge branch '2.3'
weaverryan Oct 26, 2013
31fb5b8
update framework csrf configuration
Tobion Oct 28, 2013
f3e9d17
Merge pull request #3087 from xabbuh/issue-2870-master
weaverryan Oct 28, 2013
2a50493
switch argument to key to be more precise
cordoval Oct 28, 2013
fda51ee
fix introducing typo
cordoval Oct 28, 2013
02d6a71
Merge pull request #3075 from pylebecq/dom-crawler-disable-internal-v…
weaverryan Nov 2, 2013
8a91f15
Merge branch '2.3'
weaverryan Nov 2, 2013
ae03fdb
[#3075] Moving new Form::disableValidation DomCrawler details into th…
weaverryan Nov 2, 2013
957bca4
Merge branch '2.3'
weaverryan Nov 2, 2013
10fe8a4
Removed 2.2 references as it reached eom
wouterj Nov 2, 2013
67b4d21
Merge branch '2.3'
weaverryan Nov 3, 2013
3943d8f
[#3084] Putting back message that was incorrect in 2.3, but correct i…
weaverryan Nov 3, 2013
4644e2b
Merge branch '2.3'
weaverryan Nov 3, 2013
6829df3
Removing versionadded 2.1 that leaked in from a merge up
weaverryan Nov 3, 2013
8a71cdf
Merge pull request #3114 from Tobion/patch-2
weaverryan Nov 3, 2013
f65f1d0
[#3114] Lining up spaces
weaverryan Nov 3, 2013
a516f61
Merge pull request #3119 from cordoval/patch-17
weaverryan Nov 3, 2013
9660455
use verbose HTTP status code constants
xabbuh Nov 3, 2013
e094853
Merge pull request #3148 from xabbuh/http-status-code-constants
weaverryan Nov 6, 2013
b9b60d7
Merge branch '2.3'
weaverryan Nov 6, 2013
4dfdb36
Merge branch '2.3'
weaverryan Nov 7, 2013
87962e3
Bumped version number
peterrehm Nov 9, 2013
f4975fd
Merge pull request #3175 from peterrehm/patch-5
weaverryan Nov 9, 2013
c5ae3dd
[#2956] Refactoring the scopes entry entirely to not talk about the r…
weaverryan Sep 12, 2013
d417f7b
[#2972] Many small tweaks - thanks very much to @WouterJ and @xabbuh
weaverryan Nov 12, 2013
3dcbbc2
[#2972] Clarifying how to use the request_stack with an example
weaverryan Nov 12, 2013
941a5cc
Merge pull request #2972 from symfony/scope-refactoring
weaverryan Nov 12, 2013
80a3643
some tweaks and fixes to d417f7b and 3dcbbc2
xabbuh Nov 12, 2013
ba413f4
Merge branch '2.3'
weaverryan Nov 13, 2013
343a59e
Removing some 2.1 references that were merged up
weaverryan Nov 13, 2013
2f4479d
Merge pull request #3179 from xabbuh/master-tweaks
weaverryan Nov 16, 2013
4754401
Merge branch '2.3'
weaverryan Nov 16, 2013
ff4a44e
[#2906][#3190] Removing versionadded:: 2.1 tags after merge
weaverryan Nov 16, 2013
2e91170
Merge branch '2.3'
weaverryan Nov 16, 2013
799b2c6
Merge pull request #3044 from WouterJ/document_expressionlanguage
weaverryan Nov 16, 2013
fb61db9
Merge branch '2.3'
weaverryan Nov 23, 2013
55a2de4
Removing a versionadded:: 2.1 that came from the merge
weaverryan Nov 23, 2013
2b97bbe
Merge branch '2.3' into 2.4
weaverryan Nov 27, 2013
12621a9
Merge branch '2.3' into 2.4
weaverryan Nov 27, 2013
70b475b
Merge branch '2.3' into 2.4
weaverryan Nov 27, 2013
e9a81bf
[#3044] Furthering @WouterJ's work on the ExpressionLanguage component
weaverryan Nov 17, 2013
a14c39d
[#3191] Many tweaks to expression language component thanks to @Woute…
weaverryan Nov 28, 2013
cd98a63
[#3191] Fixing semicolon thanks to @WouterJ
weaverryan Nov 28, 2013
6f0694c
Merge branch '2.3' into 2.4
weaverryan Nov 28, 2013
aea6533
documentation for the regex based exclusion of 404 errors with Monolo…
xabbuh Nov 17, 2013
6ec097d
[#3203] Minor tweaks to new 404 logging entry
weaverryan Nov 28, 2013
112d16b
Merge branch '2.3' into 2.4
weaverryan Nov 28, 2013
fe0571a
Merge branch '2.3' into 2.4
weaverryan Nov 28, 2013
22b3776
[#3205] Tweaking versionadded
weaverryan Nov 28, 2013
08de8b2
Merge branch '2.3' into 2.4
weaverryan Nov 28, 2013
4dba1ac
Changed parameter container to requestStack (2.4+)
maks-rafalko Nov 22, 2013
2198c86
Merge branch '2.3' into 2.4
weaverryan Nov 28, 2013
77b84ea
executable permission unset
petk Nov 28, 2013
0675b56
Removed assignment operator
wouterj Nov 29, 2013
e506f01
Added example of range operator
wouterj Nov 29, 2013
0725a8b
Added docs for using functions
wouterj Nov 29, 2013
6e2e583
Added article about custom functions
wouterj Nov 29, 2013
78baee9
Merge pull request #3233 from peterkokot/patch-2.4
weaverryan Nov 29, 2013
4d50f34
[#3022] Adding service container expression language details
weaverryan Nov 28, 2013
22c9404
[#3232][#3022] Making many small tweaks thanks to @WouterJ and @xabbuh
weaverryan Nov 29, 2013
4147ad4
Merge pull request #3232 from symfony/expression-framework-container
weaverryan Nov 29, 2013
240df84
Merge pull request #3241 from WouterJ/expression-furthering-component
weaverryan Nov 29, 2013
667d590
[#3241] Minor tweaks to new expression language functions
weaverryan Nov 29, 2013
4738c75
[#3232] Fixing note about expressions with parameters thanks to @WouterJ
weaverryan Dec 1, 2013
93e8cd2
Merge branch '2.3' into 2.4
weaverryan Dec 1, 2013
ac15bf5
[#3022] Adding framework documentation for routing expressions
weaverryan Dec 1, 2013
be86fef
[#3022] Adding new Expression validation constraint
weaverryan Dec 1, 2013
d72759a
[#3022] Adding all of the security-related expression functionality docs
weaverryan Dec 1, 2013
33676dc
[#3022] Adding a quick cookbook entry to highlight where the expressi…
weaverryan Dec 1, 2013
0cf1828
[#3022][#3258] Tweaks thanks to @cordoval
weaverryan Dec 1, 2013
bc22f16
[#3022][#3258] Enhancing example at @ggam's suggestion
weaverryan Dec 2, 2013
0000250
[#3258] A bunch of fixes thanks to @WouterJ
weaverryan Dec 2, 2013
816c06b
Merge pull request #3258 from symfony/expression-language-framework
weaverryan Dec 2, 2013
a9e0e66
Added Caching article
wouterj Dec 2, 2013
d6b3a14
[Cookbook] Fixes a link to the Request class
zczapran Dec 2, 2013
0a59f6d
Added doctrine note
wouterj Dec 2, 2013
d1bbdc4
Merge pull request #3261 from zczapran/2.4
weaverryan Dec 2, 2013
180fc13
Merge pull request #3260 from WouterJ/component_expression_caching
weaverryan Dec 3, 2013
be60602
[#3260] Minor tweaks when proofreading
weaverryan Dec 3, 2013
821a1b4
Merge branch '2.3' into 2.4
weaverryan Dec 3, 2013
a2ec22b
Update Callback.rst
berny46 Dec 3, 2013
1f385da
[Components][HttpKernel] Add FINISH_REQUEST to events table
bicpi Dec 4, 2013
986e876
Updated install page to v2.4.*
h4cc Dec 5, 2013
a7f2c98
Change symfony version on composer.json
paumas Dec 7, 2013
9d4a138
Merge branch 'master' into eom-2-2
weaverryan Dec 8, 2013
7e1e4a2
some tweaks to the Expression Language cache chapter
xabbuh Dec 8, 2013
7bf21c2
changed create-project example
luebbert42 Dec 7, 2013
6212968
changed version in create project example to 2.4.* and remove the hin…
luebbert42 Dec 8, 2013
6e610bf
[Components] [ExpressionLanguage] Fix missing quote
willdurand Dec 12, 2013
a45464f
Added missing argument to the evaluator function
jakzal Dec 12, 2013
2f486ce
[Security][Acl] Documentation for the new updateUserSecurityIdentity …
lemoinem Dec 12, 2013
37deaa7
document the new authentication customization options
xabbuh Aug 19, 2013
1bd187f
fixes thanks to @WouterJ
xabbuh Aug 19, 2013
8ddb26b
clarify the authenticator type
xabbuh Sep 13, 2013
afdb708
add example on how to use the new SimplePreAuthenticatorInterface
xabbuh Sep 13, 2013
a7b80a6
[Form] added multiple option to file type doc
bamarni Dec 17, 2013
bf98517
fixed spaces
bamarni Dec 17, 2013
827014e
Documented xml namespace autodiscovery.
jakzal Sep 13, 2013
47bc7dc
Documented changing of default namespace prefix.
jakzal Sep 18, 2013
68fa18e
Documented explicit namespace registration.
jakzal Sep 22, 2013
baec6de
Added a note about removing the default namespace.
jakzal Dec 16, 2013
daf5d3c
[#2979] Minor tweaks
weaverryan Dec 17, 2013
14c5382
document how to restrict a firewall to a specific host
xabbuh Sep 15, 2013
0a9241d
[#2953][#2986] Tweaks to firewall hostname
weaverryan Dec 17, 2013
7f7d7a5
Merge branch '2.3' into 2.4
weaverryan Dec 17, 2013
cc5c9a3
Merge branch '2.4'
weaverryan Dec 17, 2013
77455c9
[#2986] Fix thanks to @WouterJ
weaverryan Dec 17, 2013
cefdd6c
Merge pull request #3271 from berny46/patch-1
weaverryan Dec 18, 2013
c83cca8
Merge pull request #3274 from bicpi/document_finish_request_event
weaverryan Dec 18, 2013
d62f19b
Merge pull request #3287 from h4cc/patch-1
weaverryan Dec 19, 2013
134a7e3
Merge pull request #3298 from pauliusmasiliunas/patch-1
weaverryan Dec 19, 2013
876994a
Merge pull request #3300 from xabbuh/expression-component-cache-tweaks
weaverryan Dec 19, 2013
abe419b
Merge pull request #3315 from jakzal/patch-1
weaverryan Dec 19, 2013
d86e542
[#3315] Adding a little bit more information about the $arguments arg…
weaverryan Dec 19, 2013
fb781dd
Merge pull request #3318 from willdurand/patch-1
weaverryan Dec 23, 2013
06f2f74
Merge pull request #3319 from lemoinem/features/acl-update-security-id
weaverryan Dec 23, 2013
2a10a46
[#3319] Linking to the whole method
weaverryan Dec 23, 2013
6f286e1
Merge branch '2.3' into 2.4
weaverryan Dec 23, 2013
2cbca5f
Removing versionadded 2.1 from merge
weaverryan Dec 23, 2013
14b0c47
Merge branch '2.3' into 2.4
weaverryan Dec 23, 2013
1401372
Merge branch '2.4'
weaverryan Dec 23, 2013
34551d2
[#3319] Fixing typos thanks to @xabbuh
weaverryan Dec 26, 2013
69f8a88
Merge branch '2.3' into 2.4
weaverryan Dec 26, 2013
4834b77
How to Configure Monolog to display Console messages
tvlooy Dec 14, 2013
3945d5f
[#3340] Tweaks to console logging:
weaverryan Dec 26, 2013
7c1b2c3
Merge branch '2.3' into 2.4
weaverryan Dec 26, 2013
d31465b
Merge branch '2.4'
weaverryan Dec 26, 2013
6bdcdb1
Merge pull request #3354 from bamarni/patch-6
weaverryan Dec 26, 2013
4ef1a71
Synchronized setter injection occurs on Container::set() not on Conta…
Dec 17, 2013
0dfffff
Update PHP example to include synthetic attribute.
Dec 17, 2013
479ec86
Merge branch '2.3' into 2.4
weaverryan Dec 26, 2013
6b7d307
Merge branch '2.4'
weaverryan Dec 26, 2013
bade680
Merge branch '2.3' into 2.4
fabpot Dec 27, 2013
6c3d9eb
Merge branch '2.4'
fabpot Dec 27, 2013
f76369e
Removed duplicated DQL documentation
wouterj Jan 18, 2014
9da5986
Minor tweaks to Repository section
wouterj Jan 18, 2014
d751011
Minor tweak to configuration section
wouterj Jan 18, 2014
8be18a3
Removed some duplicated Livecycle docs
wouterj Jan 18, 2014
f1c6e94
Removed "Doctrine Extensions" section
wouterj Jan 18, 2014
9d03b69
Removed types list
wouterj Jan 18, 2014
7c2ad29
Moved commands to cookbook
wouterj Jan 18, 2014
36df975
Small tweaks to summary
wouterj Jan 18, 2014
86719ee
Clean up reference pointers list
wouterj Jan 18, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions book/controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,13 @@ itself.

Extending the base class is *optional* in Symfony; it contains useful
shortcuts but nothing mandatory. You can also extend
:class:`Symfony\\Component\\DependencyInjection\\ContainerAware`. The service
container object will then be accessible via the ``container`` property.
:class:`Symfony\\Component\\DependencyInjection\\ContainerAware` or use
the class:`Symfony\\Component\\DependencyInjection\\ContainerAwareTrait` trait
(if you have PHP 5.4). The service container object will then be accessible
via the ``container`` property.

.. versionadded:: 2.4
The ``ContainerAwareTrait`` is new in Symfony 2.4.

.. note::

Expand Down Expand Up @@ -750,12 +755,15 @@ headers and content that's sent back to the client::
use Symfony\Component\HttpFoundation\Response;

// create a simple Response with a 200 status code (the default)
$response = new Response('Hello '.$name, 200);
$response = new Response('Hello '.$name, Response::HTTP_OK);

// create a JSON-response with a 200 status code
$response = new Response(json_encode(array('name' => $name)));
$response->headers->set('Content-Type', 'application/json');

.. versionadded:: 2.4
Support for HTTP status code constants was added in Symfony 2.4.

.. tip::

The ``headers`` property is a
Expand Down
263 changes: 17 additions & 246 deletions book/doctrine.rst
Original file line number Diff line number Diff line change
Expand Up @@ -728,65 +728,18 @@ a controller, do the following::

$products = $query->getResult();

The ``getResult()`` method returns an array of results.

If you're comfortable with SQL, then DQL should feel very natural. The biggest
difference is that you need to think in terms of "objects" instead of rows
in a database. For this reason, you select *from* ``AcmeStoreBundle:Product``
and then alias it as ``p``.

The ``getResult()`` method returns an array of results. If you're querying
for just one object, you can use the ``getSingleResult()`` method instead::

$product = $query->getSingleResult();

.. caution::

The ``getSingleResult()`` method throws a ``Doctrine\ORM\NoResultException``
exception if no results are returned and a ``Doctrine\ORM\NonUniqueResultException``
if *more* than one result is returned. If you use this method, you may
need to wrap it in a try-catch block and ensure that only one result is
returned (if you're querying on something that could feasibly return
more than one result)::

$query = $em->createQuery('SELECT ...')
->setMaxResults(1);

try {
$product = $query->getSingleResult();
} catch (\Doctrine\Orm\NoResultException $e) {
$product = null;
}
// ...
in a database. For this reason, you select *from* the ``AcmeStoreBundle:Product``
*object* and then alias it as ``p``.

The DQL syntax is incredibly powerful, allowing you to easily join between
entities (the topic of :ref:`relations <book-doctrine-relations>` will be
covered later), group, etc. For more information, see the official Doctrine
`Doctrine Query Language`_ documentation.

.. sidebar:: Setting Parameters

Take note of the ``setParameter()`` method. When working with Doctrine,
it's always a good idea to set any external values as "placeholders",
which was done in the above query:

.. code-block:: text

... WHERE p.price > :price ...

You can then set the value of the ``price`` placeholder by calling the
``setParameter()`` method::

->setParameter('price', '19.99')

Using parameters instead of placing values directly in the query string
is done to prevent SQL injection attacks and should *always* be done.
If you're using multiple parameters, you can set their values at once
using the ``setParameters()`` method::

->setParameters(array(
'price' => '19.99',
'name' => 'Foo',
))

Using Doctrine's Query Builder
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down Expand Up @@ -819,10 +772,10 @@ Custom Repository Classes

In the previous sections, you began constructing and using more complex queries
from inside a controller. In order to isolate, test and reuse these queries,
it's a good idea to create a custom repository class for your entity and
it's a good practise to create a custom repository class for your entity and
add methods with your query logic there.

To do this, add the name of the repository class to your mapping definition.
To do this, add the name of the repository class to your mapping definition:

.. configuration-block::

Expand Down Expand Up @@ -1300,7 +1253,7 @@ Configuration

Doctrine is highly configurable, though you probably won't ever need to worry
about most of its options. To find out more about configuring Doctrine, see
the Doctrine section of the :doc:`reference manual </reference/configuration/doctrine>`.
the Doctrine section of the :doc:`config reference </reference/configuration/doctrine>`.

Lifecycle Callbacks
-------------------
Expand All @@ -1312,7 +1265,7 @@ stages of the lifecycle of an entity (e.g. the entity is inserted, updated,
deleted, etc).

If you're using annotations for your metadata, start by enabling the lifecycle
callbacks. This is not necessary if you're using YAML or XML for your mapping:
callbacks. This is not necessary if you're using YAML or XML for your mapping.

.. code-block:: php-annotations

Expand Down Expand Up @@ -1375,20 +1328,8 @@ the current date, only when the entity is first persisted (i.e. inserted):

Now, right before the entity is first persisted, Doctrine will automatically
call this method and the ``createdAt`` field will be set to the current date.

This can be repeated for any of the other lifecycle events, which include:

* ``preRemove``
* ``postRemove``
* ``prePersist``
* ``postPersist``
* ``preUpdate``
* ``postUpdate``
* ``postLoad``
* ``loadClassMetadata``

For more information on what these lifecycle events mean and lifecycle callbacks
in general, see Doctrine's `Lifecycle Events documentation`_
For more information on other lifecycle events and lifecycle callbacks in
general, see Doctrine's `Lifecycle Events documentation`_.

.. sidebar:: Lifecycle Callbacks and Event Listeners

Expand All @@ -1403,185 +1344,15 @@ in general, see Doctrine's `Lifecycle Events documentation`_
or subscriber and give it access to whatever resources you need. For
more information, see :doc:`/cookbook/doctrine/event_listeners_subscribers`.

Doctrine Extensions: Timestampable, Sluggable, etc.
---------------------------------------------------

Doctrine is quite flexible, and a number of third-party extensions are available
that allow you to easily perform repeated and common tasks on your entities.
These include thing such as *Sluggable*, *Timestampable*, *Loggable*, *Translatable*,
and *Tree*.

For more information on how to find and use these extensions, see the cookbook
article about :doc:`using common Doctrine extensions </cookbook/doctrine/common_extensions>`.

.. _book-doctrine-field-types:

Doctrine Field Types Reference
------------------------------

Doctrine comes with a large number of field types available. Each of these
maps a PHP data type to a specific column type in whatever database you're
using. The following types are supported in Doctrine:

* **Strings**

* ``string`` (used for shorter strings)
* ``text`` (used for larger strings)

* **Numbers**

* ``integer``
* ``smallint``
* ``bigint``
* ``decimal``
* ``float``

* **Dates and Times** (use a `DateTime`_ object for these fields in PHP)

* ``date``
* ``time``
* ``datetime``
* ``datetimetz``

* **Other Types**

* ``boolean``
* ``object`` (serialized and stored in a ``CLOB`` field)
* ``array`` (serialized and stored in a ``CLOB`` field)
* ``blob`` (mapped to a resource stream)
* ``simple_array`` (serialized using :phpfunction:`implode()` and :phpfunction:`explode()`,
with a comma as delimiter, and stored in a ``CLOB`` field)
* ``json_array`` (serialized using :phpfunction:`json_encode()` and :phpfunction:`json_decode()`,
and stored in a ``CLOB`` field)
* ``guid``

For more information, see Doctrine's `Mapping Types documentation`_.

Field Options
~~~~~~~~~~~~~

Each field can have a set of options applied to it. The available options
include ``type`` (defaults to ``string``), ``name``, ``length``, ``unique``
and ``nullable``. Take a few examples:

.. configuration-block::

.. code-block:: php-annotations

/**
* A string field with length 255 that cannot be null
* (reflecting the default values for the "type", "length"
* and *nullable* options)
*
* @ORM\Column()
*/
protected $name;

/**
* 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)
*/
protected $email;

.. code-block:: yaml

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
name:
type: string

# A string field of length 150 that persists to an "email_address" column
# and has a unique index.
email:
type: string
column: email_address
length: 150
unique: true

.. code-block:: xml

<!--
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
-->
<field name="name" type="string" />
<field name="email"
type="string"
column="email_address"
length="150"
unique="true"
/>

.. note::

There are a few more options not listed here. For more details, see
Doctrine's `Property Mapping documentation`_

.. index::
single: Doctrine; ORM console commands
single: CLI; Doctrine ORM

Console Commands
----------------

The Doctrine2 ORM integration offers several console commands under the
``doctrine`` namespace. To view the command list you can run the console
without any arguments:

.. code-block:: bash

$ php app/console

A list of available commands will print out, many of which start with the
``doctrine:`` prefix. You can find out more information about any of these
commands (or any Symfony command) by running the ``help`` command. For example,
to get details about the ``doctrine:database:create`` task, run:

.. code-block:: bash

$ php app/console help doctrine:database:create

Some notable or interesting tasks include:

* ``doctrine:ensure-production-settings`` - checks to see if the current
environment is configured efficiently for production. This should always
be run in the ``prod`` environment:

.. code-block:: bash

$ php app/console doctrine:ensure-production-settings --env=prod

* ``doctrine:mapping:import`` - allows Doctrine to introspect an existing
database and create mapping information. For more information, see
:doc:`/cookbook/doctrine/reverse_engineering`.

* ``doctrine:mapping:info`` - tells you all of the entities that Doctrine
is aware of and whether or not there are any basic errors with the mapping.

* ``doctrine:query:dql`` and ``doctrine:query:sql`` - allow you to execute
DQL or SQL queries directly from the command line.

.. note::

To be able to load data fixtures to your database, you will need to have
the DoctrineFixturesBundle bundle installed. To learn how to do it,
read the ":doc:`/bundles/DoctrineFixturesBundle/index`" entry of the
documentation.

.. tip::

This page shows working with Doctrine within a controller. You may also
want to work with Doctrine elsewhere in your application. The
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getDoctrine`
method of the controller returns the ``doctrine`` service, you can work with
this in the same way elsewhere by injecting this into your own
services. See :doc:`/book/service_container` for more on creating
your own services.
using. To see a list of all available types and more information, see
Doctrine's `Mapping Types documentation`_.

Summary
-------
Expand All @@ -1598,21 +1369,21 @@ that allow you to take different actions as objects go through their persistence
lifecycle.

For more information about Doctrine, see the *Doctrine* section of the
:doc:`cookbook </cookbook/index>`, which includes the following articles:
:doc:`cookbook </cookbook/index>`. Some usefull articles might be:

* :doc:`/bundles/DoctrineFixturesBundle/index`
* :doc:`/cookbook/doctrine/common_extensions`
* :doc:`/cookbook/doctrine/console`
* :doc:`/bundles/DoctrineFixturesBundle/index`
* :doc:`/bundles/DoctrineMongoDBBundle/index`

.. _`Doctrine`: http://www.doctrine-project.org/
.. _`MongoDB`: http://www.mongodb.org/
.. _`Basic Mapping Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html
.. _`Query Builder`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/query-builder.html
.. _`Doctrine Query Language`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/dql-doctrine-query-language.html
.. _`Association Mapping Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/association-mapping.html
.. _`DateTime`: http://php.net/manual/en/class.datetime.php
.. _`Mapping Types Documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#doctrine-mapping-types
.. _`Property Mapping documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping
.. _`Property Mapping`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping
.. _`Lifecycle Events documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/events.html#lifecycle-events
.. _`Reserved SQL keywords documentation`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#quoting-reserved-words
.. _`Persistent classes`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#persistent-classes
.. _`Property Mapping`: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/reference/basic-mapping.html#property-mapping
11 changes: 3 additions & 8 deletions book/forms.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1831,11 +1831,6 @@ The answer is to setup the constraints yourself, and attach them to the individu
fields. The overall approach is covered a bit more in the :ref:`validation chapter <book-validation-raw-values>`,
but here's a short example:

.. versionadded:: 2.1
The ``constraints`` option, which accepts a single constraint or an array
of constraints (before 2.1, the option was called ``validation_constraint``,
and only accepted a single constraint) is new to Symfony 2.1.

.. code-block:: php

use Symfony\Component\Validator\Constraints\Length;
Expand Down Expand Up @@ -1893,7 +1888,7 @@ Learn more from the Cookbook

.. _`Symfony2 Form component`: https://github.com/symfony/Form
.. _`DateTime`: http://php.net/manual/en/class.datetime.php
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bridge/Twig
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/2.2/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
.. _`Twig Bridge`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bridge/Twig
.. _`form_div_layout.html.twig`: https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
.. _`Cross-site request forgery`: http://en.wikipedia.org/wiki/Cross-site_request_forgery
.. _`view on GitHub`: https://github.com/symfony/symfony/tree/2.2/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
.. _`view on GitHub`: https://github.com/symfony/symfony/tree/master/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form
Loading