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"
|
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
|
||||||
# Configure your db driver and server_version in config/packages/doctrine.yaml
|
# 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
|
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 ###
|
###< doctrine/doctrine-bundle ###
|
||||||
GMAPS_API_KEY=insert_gmapsapikey_here
|
GMAPS_API_KEY=insert_gmapsapikey_here
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,13 @@ parameters:
|
||||||
# environment variables are not available yet.
|
# environment variables are not available yet.
|
||||||
# You should not need to change this value.
|
# You should not need to change this value.
|
||||||
env(DATABASE_URL): ''
|
env(DATABASE_URL): ''
|
||||||
|
env(LOGGING_DATABASE_URL): ''
|
||||||
|
|
||||||
doctrine:
|
doctrine:
|
||||||
dbal:
|
dbal:
|
||||||
|
default_connection: default
|
||||||
|
connections:
|
||||||
|
default:
|
||||||
# configure these for your database server
|
# configure these for your database server
|
||||||
driver: 'pdo_mysql'
|
driver: 'pdo_mysql'
|
||||||
server_version: '5.7'
|
server_version: '5.7'
|
||||||
|
|
@ -14,14 +18,36 @@ doctrine:
|
||||||
|
|
||||||
# With Symfony 3.3, remove the `resolve:` prefix
|
# With Symfony 3.3, remove the `resolve:` prefix
|
||||||
url: '%env(resolve:DATABASE_URL)%'
|
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:
|
types:
|
||||||
geometry: CrEOF\Spatial\DBAL\Types\GeometryType
|
geometry: CrEOF\Spatial\DBAL\Types\GeometryType
|
||||||
point: CrEOF\Spatial\DBAL\Types\Geometry\PointType
|
point: CrEOF\Spatial\DBAL\Types\Geometry\PointType
|
||||||
polygon: CrEOF\Spatial\DBAL\Types\Geometry\PolygonType
|
polygon: CrEOF\Spatial\DBAL\Types\Geometry\PolygonType
|
||||||
linestring: CrEOF\Spatial\DBAL\Types\Geometry\LineStringType
|
linestring: CrEOF\Spatial\DBAL\Types\Geometry\LineStringType
|
||||||
multipolygon: CrEOF\Spatial\DBAL\Types\Geometry\MultiPolygonType
|
multipolygon: CrEOF\Spatial\DBAL\Types\Geometry\MultiPolygonType
|
||||||
|
|
||||||
|
|
||||||
orm:
|
orm:
|
||||||
|
default_entity_manager: default
|
||||||
auto_generate_proxy_classes: '%kernel.debug%'
|
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
|
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||||
auto_mapping: true
|
auto_mapping: true
|
||||||
mappings:
|
mappings:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace App\Entity;
|
namespace App\Entity\Logging;
|
||||||
|
|
||||||
use Doctrine\ORM\Mapping as ORM;
|
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\Common\Persistence\Event\LifecycleEventArgs;
|
||||||
use Doctrine\ORM\Event\OnFlushEventArgs;
|
use Doctrine\ORM\Event\OnFlushEventArgs;
|
||||||
|
|
||||||
use App\Entity\EntityLog;
|
use App\Entity\Logging\EntityLog;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@ use App\EventListener\EntityListener;
|
||||||
use App\Entity\User;
|
use App\Entity\User;
|
||||||
use App\Entity\Role;
|
use App\Entity\Role;
|
||||||
use App\Entity\Hub;
|
use App\Entity\Hub;
|
||||||
use App\Entity\EntityLog;
|
|
||||||
|
use App\Entity\Logging\EntityLog;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue