Skip to content
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

Remove bundle examples #835

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
44 changes: 22 additions & 22 deletions docs/config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Sample Configuration
document_managers:
default:
mappings:
AcmeDemoBundle: ~
App: ~
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to show the standard configuration that is setup by flex: https://github.com/symfony/recipes/blob/main/doctrine/doctrine-bundle/2.9/config/packages/doctrine.yaml

In AbstractDoctrineExtension.php line 219:
Mapping definitions for Doctrine manager "default" require at least the "type", "dir" and "prefix" options.

Suggested change
App: ~
App:
is_bundle: false
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App

filters:
filter-name:
class: Class\Example\Filter\ODM\ExampleFilter
Expand All @@ -41,7 +41,7 @@ Sample Configuration
</doctrine_mongodb:options>
</doctrine_mongodb:connection>
<doctrine_mongodb:document-manager id="default">
<doctrine_mongodb:mapping name="AcmeDemoBundle" />
<doctrine_mongodb:mapping name="App" />
<doctrine_mongodb:filter name="filter-name" enabled="true" class="Class\Example\Filter\ODM\ExampleFilter" />
<doctrine_mongodb:metadata-cache-driver type="array" />
</doctrine_mongodb:document-manager>
Expand Down Expand Up @@ -83,7 +83,7 @@ If you wish to use memcache to cache your metadata, you need to configure the
document_managers:
default:
mappings:
AcmeDemoBundle: ~
App: ~
metadata_cache_driver:
type: memcached
class: Symfony\Component\Cache\Adapter\MemcachedAdapter
Expand All @@ -103,7 +103,7 @@ If you wish to use memcache to cache your metadata, you need to configure the

<doctrine_mongodb:config default-database="hello_%kernel.environment%">
<doctrine_mongodb:document-manager id="default">
<doctrine_mongodb:mapping name="AcmeDemoBundle" />
<doctrine_mongodb:mapping name="App" />
<doctrine_mongodb:metadata-cache-driver type="memcached">
<doctrine_mongodb:class>Symfony\Component\Cache\Adapter\MemcachedAdapter</doctrine_mongodb:class>
<doctrine_mongodb:host>localhost</doctrine_mongodb:host>
Expand Down Expand Up @@ -138,9 +138,9 @@ can control. The following configuration options exist for a mapping:
- ``prefix`` A common namespace prefix that all documents of this mapping
share. This prefix should never conflict with prefixes of other defined
mappings otherwise some of your documents cannot be found by Doctrine. This
option defaults to the bundle namespace + ``Document``, for example for an
application bundle called ``AcmeHelloBundle``, the prefix would be
``Acme\HelloBundle\Document``.
option defaults to the application namespace + ``Document``, for example
for an application called ``App``, the prefix would be
``App\Document``.

- ``alias`` Doctrine offers a way to alias document namespaces to simpler,
shorter names to be used in queries or for Repository access.
Expand Down Expand Up @@ -175,14 +175,14 @@ The following configuration shows a bunch of mapping examples:
document_managers:
default:
mappings:
MyBundle1: ~
MyBundle2: xml
MyBundle3: { type: attribute, dir: Documents/ }
MyBundle4: { type: xml, dir: Resources/config/doctrine/mapping }
MyBundle5:
App: ~
App2: xml
App3: { type: attribute, dir: Documents/ }
App4: { type: xml, dir: config/doctrine/mapping }
App5:
type: xml
dir: my-bundle-mappings-dir
alias: BundleAlias
dir: my-app-mappings-dir
alias: AppAlias
doctrine_extensions:
type: xml
dir: "%kernel.project_dir%/src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents"
Expand All @@ -201,10 +201,10 @@ The following configuration shows a bunch of mapping examples:

<doctrine_mongodb:config>
<doctrine_mongodb:document-manager id="default">
<doctrine_mongodb:mapping name="MyBundle1" />
<doctrine_mongodb:mapping name="MyBundle2" type="attribute" dir="Documents/" />
<doctrine_mongodb:mapping name="MyBundle3" type="xml" dir="Resources/config/doctrine/mapping" />
<doctrine_mongodb:mapping name="MyBundle4" type="xml" dir="my-bundle-mappings-dir" alias="BundleAlias" />
<doctrine_mongodb:mapping name="App1" />
<doctrine_mongodb:mapping name="App2" type="attribute" dir="Documents/" />
<doctrine_mongodb:mapping name="App3" type="xml" dir="config/doctrine/mapping" />
<doctrine_mongodb:mapping name="App4" type="xml" dir="my-app-mappings-dir" alias="AppAlias" />
<doctrine_mongodb:mapping name="doctrine_extensions"
type="xml"
dir="%kernel.project_dir%/src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents"
Expand Down Expand Up @@ -332,12 +332,12 @@ following syntax:
database: db1
metadata_cache_driver: array
mappings:
AcmeDemoBundle: ~
App: ~
dm2:
connection: conn2
database: db2
mappings:
AcmeHelloBundle: ~
AnotherApp: ~

.. code-block:: xml

Expand All @@ -364,10 +364,10 @@ following syntax:
</doctrine_mongodb:options>
</doctrine_mongodb:connection>
<doctrine_mongodb:document-manager id="dm1" metadata-cache-driver="array" connection="conn1" database="db1">
<doctrine_mongodb:mapping name="AcmeDemoBundle" />
<doctrine_mongodb:mapping name="App" />
</doctrine_mongodb:document-manager>
<doctrine_mongodb:document-manager id="dm2" connection="conn2" database="db2">
<doctrine_mongodb:mapping name="AcmeHelloBundle" />
<doctrine_mongodb:mapping name="AnotherApp" />
</doctrine_mongodb:document-manager>
</doctrine_mongodb:config>
</container>
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To install DoctrineMongoDBBundle with Composer run the following command:
Enable the Bundle
-----------------

Your bundle should be automatically enabled if you use Flex.
The bundle should be automatically enabled if you use Flex.
Otherwise, you'll need to manually enable the bundle by adding the
following line in the ``config/bundles.php`` file of your project:

Expand Down
14 changes: 7 additions & 7 deletions src/DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ private function normalizeDriverOptions(array $connection): array
*
* doctrine_mongodb:
* mappings:
* MyBundle1: ~
* MyBundle2: xml
* MyBundle3: { type: attribute }
* MyBundle4: { type: xml, dir: Resources/config/doctrine/mapping }
* MyBundle5:
* App1: ~
* App2: xml
* App3: { type: attribute }
* App4: { type: xml, dir: config/doctrine/mapping }
* App5:
* type: xml
* dir: [bundle-mappings1/, bundle-mappings2/]
* alias: BundleAlias
* dir: [app-mappings1/, app-mappings2/]
* alias: AppAlias
* arbitrary_key:
* type: xml
* dir: %kernel.dir%/../src/vendor/DoctrineExtensions/lib/DoctrineExtensions/Documents
Expand Down