Skip to content

Commit 206bf70

Browse files
committed
Updated Doctrine config reference about bundles
1 parent e80995b commit 206bf70

File tree

1 file changed

+13
-22
lines changed

1 file changed

+13
-22
lines changed

reference/configuration/doctrine.rst

Lines changed: 13 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -492,42 +492,35 @@ you can control. The following configuration options exist for a mapping:
492492
type
493493
....
494494

495-
One of ``annotation``, ``xml``, ``yml``, ``php`` or ``staticphp``. This
496-
specifies which type of metadata type your mapping uses.
495+
One of ``annotation`` (the default value), ``xml``, ``yml``, ``php`` or
496+
``staticphp``. This specifies which type of metadata type your mapping uses.
497497

498498
dir
499499
...
500500

501-
Path to the mapping or entity files (depending on the driver). If this path
502-
is relative it is assumed to be relative to the bundle root. This only works
503-
if the name of your mapping is a bundle name. If you want to use this option
504-
to specify absolute paths you should prefix the path with the kernel parameters
505-
that exist in the DIC (for example ``%kernel.project_dir%``).
501+
Absolute path to the mapping or entity files (depending on the driver). The
502+
default value is ``%kernel.project_dir%/src/Entity/``.
506503

507504
prefix
508505
......
509506

510-
A common namespace prefix that all entities of this mapping share. This
511-
prefix should never conflict with prefixes of other defined mappings otherwise
512-
some of your entities cannot be found by Doctrine. This option defaults
513-
to the bundle namespace + ``Entity``, for example for an application bundle
514-
called AcmeHelloBundle prefix would be ``Acme\HelloBundle\Entity``.
507+
A common namespace prefix that all entities of this mapping share. This prefix
508+
should never conflict with prefixes of other defined mappings otherwise some of
509+
your entities cannot be found by Doctrine. This option defaults to
510+
``App\Entity`` because it's recommended to store the entities in ``src/Entity/``.
515511

516512
alias
517513
.....
518514

519515
Doctrine offers a way to alias entity namespaces to simpler, shorter names
520-
to be used in DQL queries or for Repository access. When using a bundle
521-
the alias defaults to the bundle name.
516+
to be used in DQL queries or for Repository access. It's default value is ``App``.
522517

523518
is_bundle
524519
.........
525520

526-
This option is a derived value from ``dir`` and by default is set to ``true``
527-
if dir is relative proved by a ``file_exists()`` check that returns ``false``.
528-
It is ``false`` if the existence check returns ``true``. In this case an
529-
absolute path was specified and the metadata files are most likely in a
530-
directory outside of a bundle.
521+
This option is ``false`` by default and it's considered a legacy option. It was
522+
only useful in previous Symfony versions, when it was recommended to use bundles
523+
to organize the application code.
531524

532525
Custom Mapping Entities in a Bundle
533526
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -593,9 +586,7 @@ directory instead:
593586
Mapping Entities Outside of a Bundle
594587
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
595588

596-
You can also create new mappings, for example outside of the Symfony folder.
597-
598-
For example, the following looks for entity classes in the ``App\Entity``
589+
For example, the following looks for entity classes in the ``Entity``
599590
namespace in the ``src/Entity`` directory and gives them an ``App`` alias
600591
(so you can say things like ``App:Post``):
601592

0 commit comments

Comments
 (0)