E1.11 Php Symfony: Configure Doctrine files (Wpf, Xamarin, Angular SPA, Reactjs SPA) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki

  • Open the "LitGenreViewEntity.php"-file

picture

At the begining of the file you wil find the following instructions

// ///////////////////////////////////////////////////////////////////////////////
// to create database tables you can apply the following config parameters in the "config/packages/doctrine.yaml"-file
// than create DB tables with the following commands:
//
// php bin/console make:migration --em=litdbcontextdeploymanager
// php bin/console doctrine:migrations:migrate --em=litdbcontextdeploymanager
//
// or commands:
//
// php bin/console doctrine:migrations:diff --em=litdbcontextdeploymanager
// php bin/console doctrine:migrations:migrate --em=litdbcontextdeploymanager
//
// ///////////////////////////////////////////////////////////////////////////////
// doctrine:
//    dbal:
//       default_connection: here is a name of default connection (for instance, default_connection: litdbcontextdeployconnection)
//
//       connections:
//       ...
//          litdbcontextdeployconnection:
//                # configure these for your database server 
//                url: '%env(resolve:DATABASE_LITDBCONTEXT_URL)%'
//                # driver: 'pdo_mysql'
//                # server_version: '5.7'
//                # charset: utf8mb4
//    orm:
//       default_entity_manager: here is a name of default manager (for instance, default_entity_manager: litdbcontextdeploymanager)
//
//       entity_managers:
//       ...
//          litdbcontextdeploymanager:
//              connection: litdbcontextdeployconnection
//              mappings:
//                  Litdbcontextdeploy:
//                      is_bundle: false
//                      type: annotation 
//                      dir: '%kernel.project_dir%/src/Deployment/Literature'
//                      prefix: 'App\Deployment\Literature'
//                      alias: litdbcontextdeploymanager  
//
// ///////////////////////////////////////////////////////////////////////////////
// "config/packages/doctrine.yaml"-file  expects ".env"-file to have the following config parameters like below
// ///////////////////////////////////////////////////////////////////////////////
// ...
// ### > doctrine/doctrine-bundle ###
// # Format described at https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
// # IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml
// #
// DATABASE_LITDBCONTEXT_URL="mysql://root:[email protected]:3306/schema_name_here?serverVersion=8.0"
// ### < doctrine/doctrine-bundle ###
// ...
// ///////////////////////////////////////////////////////////////////////////////

  • modify "config/packages/doctrine.yaml"-file according to the instructions:

picture

doctrine:
    dbal:
        default_connection: litdbcontextdeployconnection
        connections:
            litdbcontextdeployconnection:
                # configure these for your database server 
                url: '%env(resolve:DATABASE_LITDBCONTEXT_URL)%'
                # driver: 'pdo_mysql'
                # server_version: '5.7'
                # charset: utf8mb4
    orm:
        default_entity_manager: litdbcontextdeploymanager
        entity_managers:
            litdbcontextdeploymanager:
                connection: litdbcontextdeployconnection
                mappings:
                    Litdbcontextdeploy:
                        is_bundle: false
                        type: annotation 
                        dir: '%kernel.project_dir%/src/Deployment/Literature'
                        prefix: 'App\Deployment\Literature'
                        alias: litdbcontextdeploymanager  

  • modify ".env"-file according to the instructions:

picture