Modify doctrine.yaml to support multiple entity managers. #330
This commit is contained in:
parent
5c22fd7cc7
commit
c748a19da8
5 changed files with 154 additions and 126 deletions
|
|
@ -14,6 +14,7 @@ APP_SECRET=b344cd6cd151ae1d61403ed55806c5ce
|
|||
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
|
||||
# Configure your db driver and server_version in config/packages/doctrine.yaml
|
||||
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_name
|
||||
LOGGING_DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3306/db_logging
|
||||
###< doctrine/doctrine-bundle ###
|
||||
GMAPS_API_KEY=insert_gmapsapikey_here
|
||||
|
||||
|
|
|
|||
|
|
@ -4,9 +4,13 @@ parameters:
|
|||
# environment variables are not available yet.
|
||||
# You should not need to change this value.
|
||||
env(DATABASE_URL): ''
|
||||
env(LOGGING_DATABASE_URL): ''
|
||||
|
||||
doctrine:
|
||||
dbal:
|
||||
default_connection: default
|
||||
connections:
|
||||
default:
|
||||
# configure these for your database server
|
||||
driver: 'pdo_mysql'
|
||||
server_version: '5.7'
|
||||
|
|
@ -14,14 +18,36 @@ doctrine:
|
|||
|
||||
# With Symfony 3.3, remove the `resolve:` prefix
|
||||
url: '%env(resolve:DATABASE_URL)%'
|
||||
logging:
|
||||
# configure these for your database server
|
||||
url: '%env(resolve:LOGGING_DATABASE_URL)%'
|
||||
driver: 'pdo_mysql'
|
||||
server_version: '5.7'
|
||||
charset: utf8mb4
|
||||
types:
|
||||
geometry: CrEOF\Spatial\DBAL\Types\GeometryType
|
||||
point: CrEOF\Spatial\DBAL\Types\Geometry\PointType
|
||||
polygon: CrEOF\Spatial\DBAL\Types\Geometry\PolygonType
|
||||
linestring: CrEOF\Spatial\DBAL\Types\Geometry\LineStringType
|
||||
multipolygon: CrEOF\Spatial\DBAL\Types\Geometry\MultiPolygonType
|
||||
|
||||
|
||||
orm:
|
||||
default_entity_manager: default
|
||||
auto_generate_proxy_classes: '%kernel.debug%'
|
||||
entity_managers:
|
||||
logging:
|
||||
connection: logging
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||
mappings:
|
||||
Log:
|
||||
is_bundle: false
|
||||
type: annotation
|
||||
dir: '%kernel.project_dir%/src/Entity/Logging'
|
||||
prefix: 'App\Entity\Logging'
|
||||
alias: Log
|
||||
default:
|
||||
connection: default
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||
auto_mapping: true
|
||||
mappings:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
namespace App\Entity;
|
||||
namespace App\Entity\Logging;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
|
|
@ -7,7 +7,7 @@ use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
|
|||
use Doctrine\Common\Persistence\Event\LifecycleEventArgs;
|
||||
use Doctrine\ORM\Event\OnFlushEventArgs;
|
||||
|
||||
use App\Entity\EntityLog;
|
||||
use App\Entity\Logging\EntityLog;
|
||||
|
||||
use DateTime;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,8 @@ use App\EventListener\EntityListener;
|
|||
use App\Entity\User;
|
||||
use App\Entity\Role;
|
||||
use App\Entity\Hub;
|
||||
use App\Entity\EntityLog;
|
||||
|
||||
use App\Entity\Logging\EntityLog;
|
||||
|
||||
use DateTime;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue