
upgraded laravel version from 5.0 to 5.2. Changed ORM from eloquent to Doctrine to support better inheritance handling basically eloquent does not suppor the inheritance model used by Silverstripe which makes dificult to implement write apis on model hierarchies defined with SS schema. Refactoring. Change-Id: I802e171c8b95e81dc21578543ddb6a02003985e5
232 lines
10 KiB
PHP
232 lines
10 KiB
PHP
<?php
|
|
|
|
return [
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Entity Mangers
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Configure your Entity Managers here. You can set a different connection
|
|
| and driver per manager and configure events and filters. Change the
|
|
| paths setting to the appropriate path and replace App namespace
|
|
| by your own namespace.
|
|
|
|
|
| Available meta drivers: fluent|annotations|yaml|xml|config|static_php|php
|
|
|
|
|
| Available connections: mysql|oracle|pgsql|sqlite|sqlsrv
|
|
| (Connections can be configured in the database config)
|
|
|
|
|
| --> Warning: Proxy auto generation should only be enabled in dev!
|
|
|
|
|
*/
|
|
'managers' => [
|
|
'default' => [
|
|
'dev' => env('APP_DEBUG'),
|
|
'meta' => env('DOCTRINE_METADATA', 'annotations'),
|
|
'connection' => env('DB_CONNECTION', 'openstackid_resources'),
|
|
'namespaces' => [
|
|
'App'
|
|
],
|
|
'paths' => [
|
|
base_path('app/Models/ResourceServer')
|
|
],
|
|
'repository' => Doctrine\ORM\EntityRepository::class,
|
|
'proxies' => [
|
|
'namespace' => false,
|
|
'path' => storage_path('proxies'),
|
|
'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
|
|
],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Doctrine events
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The listener array expects the key to be a Doctrine event
|
|
| e.g. Doctrine\ORM\Events::onFlush
|
|
|
|
|
*/
|
|
'events' => [
|
|
'listeners' => [],
|
|
'subscribers' => []
|
|
],
|
|
'filters' => [],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Doctrine mapping types
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Link a Database Type to a Local Doctrine Type
|
|
|
|
|
| Using 'enum' => 'string' is the same of:
|
|
| $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration,
|
|
| \Doctrine\DBAL\Connection $connection,
|
|
| \Doctrine\Common\EventManager $eventManager) {
|
|
| $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
|
| });
|
|
|
|
|
| References:
|
|
| http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html
|
|
| http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types
|
|
| http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html
|
|
| http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types
|
|
| http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'mapping_types' => [
|
|
//'enum' => 'string'
|
|
]
|
|
],
|
|
'ss' => [
|
|
'dev' => env('APP_DEBUG'),
|
|
'meta' => env('DOCTRINE_METADATA', 'annotations'),
|
|
'connection' => 'ss',
|
|
'namespaces' => [
|
|
'App'
|
|
],
|
|
'paths' => [
|
|
base_path('app/Models/Foundation')
|
|
],
|
|
'repository' => Doctrine\ORM\EntityRepository::class,
|
|
'proxies' => [
|
|
'namespace' => false,
|
|
'path' => storage_path('proxies'),
|
|
'auto_generate' => env('DOCTRINE_PROXY_AUTOGENERATE', false)
|
|
],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Doctrine events
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| The listener array expects the key to be a Doctrine event
|
|
| e.g. Doctrine\ORM\Events::onFlush
|
|
|
|
|
*/
|
|
'events' => [
|
|
'listeners' => [],
|
|
'subscribers' => []
|
|
],
|
|
'filters' => [],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Doctrine mapping types
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Link a Database Type to a Local Doctrine Type
|
|
|
|
|
| Using 'enum' => 'string' is the same of:
|
|
| $doctrineManager->extendAll(function (\Doctrine\ORM\Configuration $configuration,
|
|
| \Doctrine\DBAL\Connection $connection,
|
|
| \Doctrine\Common\EventManager $eventManager) {
|
|
| $connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
|
| });
|
|
|
|
|
| References:
|
|
| http://doctrine-orm.readthedocs.org/en/latest/cookbook/custom-mapping-types.html
|
|
| http://doctrine-dbal.readthedocs.org/en/latest/reference/types.html#custom-mapping-types
|
|
| http://doctrine-orm.readthedocs.org/en/latest/cookbook/advanced-field-value-conversion-using-custom-mapping-types.html
|
|
| http://doctrine-orm.readthedocs.org/en/latest/reference/basic-mapping.html#reference-mapping-types
|
|
| http://symfony.com/doc/current/cookbook/doctrine/dbal.html#registering-custom-mapping-types-in-the-schematool
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'mapping_types' => [
|
|
//'enum' => 'string'
|
|
]
|
|
]
|
|
],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Doctrine Extensions
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Enable/disable Doctrine Extensions by adding or removing them from the list
|
|
|
|
|
| If you want to require custom extensions you will have to require
|
|
| laravel-doctrine/extensions in your composer.json
|
|
|
|
|
*/
|
|
'extensions' => [
|
|
//LaravelDoctrine\ORM\Extensions\TablePrefix\TablePrefixExtension::class,
|
|
//LaravelDoctrine\Extensions\Timestamps\TimestampableExtension::class,
|
|
//LaravelDoctrine\Extensions\SoftDeletes\SoftDeleteableExtension::class,
|
|
//LaravelDoctrine\Extensions\Sluggable\SluggableExtension::class,
|
|
//LaravelDoctrine\Extensions\Sortable\SortableExtension::class,
|
|
//LaravelDoctrine\Extensions\Tree\TreeExtension::class,
|
|
//LaravelDoctrine\Extensions\Loggable\LoggableExtension::class,
|
|
//LaravelDoctrine\Extensions\Blameable\BlameableExtension::class,
|
|
//LaravelDoctrine\Extensions\IpTraceable\IpTraceableExtension::class,
|
|
//LaravelDoctrine\Extensions\Translatable\TranslatableExtension::class
|
|
],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Doctrine custom types
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Create a custom or override a Doctrine Type
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'custom_types' => [
|
|
'json' => LaravelDoctrine\ORM\Types\Json::class
|
|
],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| DQL custom datetime functions
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'custom_datetime_functions' => [],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| DQL custom numeric functions
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'custom_numeric_functions' => [],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| DQL custom string functions
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'custom_string_functions' => [],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Enable query logging with laravel file logging,
|
|
| debugbar, clockwork or an own implementation.
|
|
| Setting it to false, will disable logging
|
|
|
|
|
| Available:
|
|
| - LaravelDoctrine\ORM\Loggers\LaravelDebugbarLogger
|
|
| - LaravelDoctrine\ORM\Loggers\ClockworkLogger
|
|
| - LaravelDoctrine\ORM\Loggers\FileLogger
|
|
|--------------------------------------------------------------------------
|
|
*/
|
|
'logger' => env('DOCTRINE_LOGGER', 'LaravelDoctrine\ORM\Loggers\FileLogger'),
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Cache
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Configure meta-data, query and result caching here.
|
|
| Optionally you can enable second level caching.
|
|
|
|
|
| Available: acp|array|file|memcached|redis|void
|
|
|
|
|
*/
|
|
'cache' => [
|
|
'default' => env('DOCTRINE_CACHE', 'redis'),
|
|
'namespace' => null,
|
|
'second_level' => true,
|
|
],
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Gedmo extensions
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Settings for Gedmo extensions
|
|
| If you want to use this you will have to require
|
|
| laravel-doctrine/extensions in your composer.json
|
|
|
|
|
*/
|
|
'gedmo' => [
|
|
'all_mappings' => false
|
|
]
|
|
];
|