E1.15 Php Symfony: Configure Doctrine for production (Wpf, Xamarin, Angular SPA, Reactjs SPA) - chempkovsky/CS2WPF-and-CS2XAMARIN GitHub Wiki
Note:
In the "E1.14"-article we described how to create production ViewModel-files and controller-file. Here we need to make some settings.
Configuration:
- Open the "LitGenreViewController.php"-file
At the begining of the file you wil find the following instructions
// ///////////////////////////////////////////////////////////////////////////////
// the generated code expects "config/packages/doctrine.yaml"-file to have the following config parameters
// ///////////////////////////////////////////////////////////////////////////////
// doctrine:
// dbal:
// default_connection: here is a name of default connection (for instance, default_connection: litdbcontextconnection)
//
// connections:
// ...
// litdbcontextconnection:
// # 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: litdbcontextmanager)
//
// entity_managers:
// ...
// litdbcontextmanager:
// connection: litdbcontextconnection
// mappings:
// Litdbcontext:
// is_bundle: false
// type: annotation
// dir: '%kernel.project_dir%/src/Production/Literature/Entity'
// prefix: 'App\Production\Literature\Entity'
// alias: litdbcontextmanager
//
// ///////////////////////////////////////////////////////////////////////////////
// "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:
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
litdbcontextconnection:
# 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
litdbcontextmanager:
connection: litdbcontextconnection
mappings:
Litdbcontext:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Production/Literature/Entity'
prefix: 'App\Production\Literature\Entity'
alias: litdbcontextmanager
- ".env"-file will be the same: