Skip to content

Commit 28046da

Browse files
committed
Merge branch '3.4'
* 3.4: fixing a bit more on a bad merge fixing bad merge Implement proposed changes Remove whitespace Use preferred way of retrieving authenticated user Break long lines Clarify comment about "Retrieving the User Object" Minor reword about assets:install Reorder DoctrineBundle configuration sections
2 parents 079ee86 + 4cc445c commit 28046da

File tree

3 files changed

+109
-112
lines changed

3 files changed

+109
-112
lines changed

reference/configuration/doctrine.rst

Lines changed: 102 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -270,102 +270,6 @@ Full Default Configuration
270270
</doctrine:config>
271271
</container>
272272
273-
Configuration Overview
274-
----------------------
275-
276-
This following configuration example shows all the configuration defaults
277-
that the ORM resolves to:
278-
279-
.. code-block:: yaml
280-
281-
doctrine:
282-
orm:
283-
auto_mapping: true
284-
# the standard distribution overrides this to be true in debug, false otherwise
285-
auto_generate_proxy_classes: false
286-
proxy_namespace: Proxies
287-
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
288-
default_entity_manager: default
289-
metadata_cache_driver: array
290-
query_cache_driver: array
291-
result_cache_driver: array
292-
293-
There are lots of other configuration options that you can use to overwrite
294-
certain classes, but those are for very advanced use-cases only.
295-
296-
Caching Drivers
297-
~~~~~~~~~~~~~~~
298-
299-
The built-in types of caching drivers are: ``array``, ``apc``, ``apcu``,
300-
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata`` and ``xcache``.
301-
There is a special type called ``service`` which lets you define the ID of your
302-
own caching service.
303-
304-
The following example shows an overview of the caching configurations:
305-
306-
.. code-block:: yaml
307-
308-
doctrine:
309-
orm:
310-
auto_mapping: true
311-
# each caching driver type defines its own config options
312-
metadata_cache_driver: apc
313-
result_cache_driver:
314-
type: memcache
315-
host: localhost
316-
port: 11211
317-
instance_class: Memcache
318-
# the 'service' type requires to define the 'id' option too
319-
query_cache_driver:
320-
type: service
321-
id: my_doctrine_common_cache_service
322-
323-
Mapping Configuration
324-
~~~~~~~~~~~~~~~~~~~~~
325-
326-
Explicit definition of all the mapped entities is the only necessary
327-
configuration for the ORM and there are several configuration options that
328-
you can control. The following configuration options exist for a mapping:
329-
330-
type
331-
....
332-
333-
One of ``annotation``, ``xml``, ``yml``, ``php`` or ``staticphp``. This
334-
specifies which type of metadata type your mapping uses.
335-
336-
dir
337-
...
338-
339-
Path to the mapping or entity files (depending on the driver). If this path
340-
is relative it is assumed to be relative to the bundle root. This only works
341-
if the name of your mapping is a bundle name. If you want to use this option
342-
to specify absolute paths you should prefix the path with the kernel parameters
343-
that exist in the DIC (for example ``%kernel.project_dir%``).
344-
345-
prefix
346-
......
347-
348-
A common namespace prefix that all entities of this mapping share. This
349-
prefix should never conflict with prefixes of other defined mappings otherwise
350-
some of your entities cannot be found by Doctrine. This option defaults
351-
to the bundle namespace + ``Entity``, for example for an application bundle
352-
called AcmeHelloBundle prefix would be ``Acme\HelloBundle\Entity``.
353-
354-
alias
355-
.....
356-
357-
Doctrine offers a way to alias entity namespaces to simpler, shorter names
358-
to be used in DQL queries or for Repository access. When using a bundle
359-
the alias defaults to the bundle name.
360-
361-
is_bundle
362-
.........
363-
364-
This option is a derived value from ``dir`` and by default is set to ``true``
365-
if dir is relative proved by a ``file_exists()`` check that returns ``false``.
366-
It is ``false`` if the existence check returns ``true``. In this case an
367-
absolute path was specified and the metadata files are most likely in a
368-
directory outside of a bundle.
369273
370274
.. index::
371275
single: Configuration; Doctrine DBAL
@@ -492,8 +396,31 @@ service where ``[name]`` is the name of the connection.
492396

493397
.. _DBAL documentation: http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html
494398

399+
Doctrine ORM Configuration
400+
--------------------------
401+
402+
This following configuration example shows all the configuration defaults
403+
that the ORM resolves to:
404+
405+
.. code-block:: yaml
406+
407+
doctrine:
408+
orm:
409+
auto_mapping: true
410+
# the standard distribution overrides this to be true in debug, false otherwise
411+
auto_generate_proxy_classes: false
412+
proxy_namespace: Proxies
413+
proxy_dir: '%kernel.cache_dir%/doctrine/orm/Proxies'
414+
default_entity_manager: default
415+
metadata_cache_driver: array
416+
query_cache_driver: array
417+
result_cache_driver: array
418+
419+
There are lots of other configuration options that you can use to overwrite
420+
certain classes, but those are for very advanced use-cases only.
421+
495422
Shortened Configuration Syntax
496-
------------------------------
423+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
497424

498425
When you are only using one entity manager, all config options available
499426
can be placed directly under ``doctrine.orm`` config level.
@@ -525,8 +452,82 @@ can be placed directly under ``doctrine.orm`` config level.
525452
This shortened version is commonly used in other documentation sections.
526453
Keep in mind that you can't use both syntaxes at the same time.
527454

455+
Caching Drivers
456+
~~~~~~~~~~~~~~~
457+
458+
The built-in types of caching drivers are: ``array``, ``apc``, ``apcu``,
459+
``memcache``, ``memcached``, ``redis``, ``wincache``, ``zenddata`` and ``xcache``.
460+
There is a special type called ``service`` which lets you define the ID of your
461+
own caching service.
462+
463+
The following example shows an overview of the caching configurations:
464+
465+
.. code-block:: yaml
466+
467+
doctrine:
468+
orm:
469+
auto_mapping: true
470+
# each caching driver type defines its own config options
471+
metadata_cache_driver: apc
472+
result_cache_driver:
473+
type: memcache
474+
host: localhost
475+
port: 11211
476+
instance_class: Memcache
477+
# the 'service' type requires to define the 'id' option too
478+
query_cache_driver:
479+
type: service
480+
id: my_doctrine_common_cache_service
481+
482+
Mapping Configuration
483+
~~~~~~~~~~~~~~~~~~~~~
484+
485+
Explicit definition of all the mapped entities is the only necessary
486+
configuration for the ORM and there are several configuration options that
487+
you can control. The following configuration options exist for a mapping:
488+
489+
type
490+
....
491+
492+
One of ``annotation``, ``xml``, ``yml``, ``php`` or ``staticphp``. This
493+
specifies which type of metadata type your mapping uses.
494+
495+
dir
496+
...
497+
498+
Path to the mapping or entity files (depending on the driver). If this path
499+
is relative it is assumed to be relative to the bundle root. This only works
500+
if the name of your mapping is a bundle name. If you want to use this option
501+
to specify absolute paths you should prefix the path with the kernel parameters
502+
that exist in the DIC (for example ``%kernel.project_dir%``).
503+
504+
prefix
505+
......
506+
507+
A common namespace prefix that all entities of this mapping share. This
508+
prefix should never conflict with prefixes of other defined mappings otherwise
509+
some of your entities cannot be found by Doctrine. This option defaults
510+
to the bundle namespace + ``Entity``, for example for an application bundle
511+
called AcmeHelloBundle prefix would be ``Acme\HelloBundle\Entity``.
512+
513+
alias
514+
.....
515+
516+
Doctrine offers a way to alias entity namespaces to simpler, shorter names
517+
to be used in DQL queries or for Repository access. When using a bundle
518+
the alias defaults to the bundle name.
519+
520+
is_bundle
521+
.........
522+
523+
This option is a derived value from ``dir`` and by default is set to ``true``
524+
if dir is relative proved by a ``file_exists()`` check that returns ``false``.
525+
It is ``false`` if the existence check returns ``true``. In this case an
526+
absolute path was specified and the metadata files are most likely in a
527+
directory outside of a bundle.
528+
528529
Custom Mapping Entities in a Bundle
529-
-----------------------------------
530+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
530531

531532
Doctrine's ``auto_mapping`` feature loads annotation configuration from
532533
the ``Entity/`` directory of each bundle *and* looks for other formats (e.g.
@@ -587,7 +588,7 @@ directory instead:
587588
));
588589
589590
Mapping Entities Outside of a Bundle
590-
------------------------------------
591+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
591592

592593
You can also create new mappings, for example outside of the Symfony folder.
593594

@@ -652,7 +653,7 @@ namespace in the ``src/Entity`` directory and gives them an ``App`` alias
652653
));
653654
654655
Detecting a Mapping Configuration Format
655-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
656+
........................................
656657

657658
If the ``type`` on the bundle configuration isn't set, the DoctrineBundle
658659
will try to detect the correct mapping configuration format for the bundle.
@@ -671,7 +672,7 @@ root directory. If the folder exist, Doctrine will fall back to using an
671672
annotation driver.
672673

673674
Default Value of Dir
674-
~~~~~~~~~~~~~~~~~~~~
675+
....................
675676

676677
If ``dir`` is not specified, then its default value depends on which configuration
677678
driver is being used. For drivers that rely on the PHP files (annotation,

security.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,14 +1002,12 @@ look like::
10021002

10031003
use Symfony\Component\Security\Core\User\UserInterface;
10041004

1005-
public function indexAction(UserInterface $user)
1005+
public function indexAction()
10061006
{
1007-
if (!$this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
1008-
throw $this->createAccessDeniedException();
1009-
}
1007+
$this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
10101008

1011-
// the above is a shortcut for this
1012-
$user = $this->get('security.token_storage')->getToken()->getUser();
1009+
$user = $this->getUser();
1010+
// or you can also type-hint a method argument with UserInterface: e.g. "UserInterface $user"
10131011
}
10141012

10151013
.. tip::
@@ -1018,10 +1016,8 @@ look like::
10181016
your :ref:`user provider <security-user-providers>`.
10191017

10201018
.. versionadded:: 3.2
1021-
The functionality to get the user via the method signature was introduced in
1022-
Symfony 3.2. You can still retrieve it by calling ``$this->getUser()`` if you
1023-
extend the :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller`
1024-
class.
1019+
The ability to get the user by type-hinting an argument with UserInterface
1020+
was introduced in Symfony 3.2.
10251021

10261022
Now you can call whatever methods are on *your* User object. For example,
10271023
if your User object has a ``getFirstName()`` method, you could use that::

templating.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ block of the base template.
881881
You can also include assets located in your bundles' ``Resources/public`` folder.
882882
You will need to run the ``php bin/console assets:install target [--symlink]``
883883
command, which copies (or symlinks) files into the correct location. (target
884-
is by default "web").
884+
is by default the "web/" directory of your application).
885885

886886
.. code-block:: html+twig
887887

0 commit comments

Comments
 (0)