Skip to content

Commit

Permalink
small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rustagir committed Jun 6, 2024
1 parent 6756e75 commit 1f5d6fd
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion source/includes/php-frameworks/symfony/Restaurant.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#[ODM\Document(collection: 'restaurants')]
class Restaurant
{
#[ODM\Field]
#[ODM\Id]
public ?string $id = null;

#[ODM\Field]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class RestaurantController extends AbstractController

public function __construct(DocumentManager $dm, LoggerInterface $logger)
{
$this->dm = $logger;
$this->dm = $dm;
$this->logger = $logger;
}

Expand Down
18 changes: 18 additions & 0 deletions source/includes/php-frameworks/symfony/doctrine_mongodb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
doctrine_mongodb:
auto_generate_proxy_classes: true
auto_generate_hydrator_classes: true
connections:
default:
server: "%env(resolve:MONGODB_URL)%"
default_database: "%env(resolve:MONGODB_DB)%"
document_managers:
default:
auto_mapping: true
mappings:
App:
dir: "%kernel.project_dir%/src/Document"
mapping: true
type: attribute
prefix: 'App\Document'
is_bundle: false
alias: App
21 changes: 2 additions & 19 deletions source/php-frameworks/symfony.txt
Original file line number Diff line number Diff line change
Expand Up @@ -184,27 +184,10 @@ Configure the ODM
In the ``config/packages`` directory, replace the contents of your
``doctrine_mongodb.yaml`` file with the following code:

.. code-block:: yaml
.. literalinclude:: /includes/php-frameworks/symfony/doctrine_mongodb.yaml
:caption: config/packages/doctrine_mongodb.yaml
:language: yaml

doctrine_mongodb:
auto_generate_proxy_classes: true
auto_generate_hydrator_classes: true
connections:
default:
server: '%env(resolve:MONGODB_URL)'
default_database: '%env(resolve:MONGODB_DB)%'
document_managers:
default:
auto_mapping: true
mappings:
App:
dir: '%kernel.project_dir%/src/Document'
mapping: true
type: attribute
prefix: 'App\Document'
is_bundle: false
alias: App

Install Frontend Dependency
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down

0 comments on commit 1f5d6fd

Please sign in to comment.