Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
anis-next
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
anis
anis-next
Commits
9420e3c5
Commit
9420e3c5
authored
3 years ago
by
François Agneray
Browse files
Options
Downloads
Patches
Plain Diff
Fixed bug: DATABASE_DEV_MODE=0
parent
463ef39a
No related branches found
No related tags found
1 merge request
!72
Develop
Pipeline
#8018
passed
3 years ago
Stage: trigger-child-pipelines
Pipeline: anis-next
#8019
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
server/.gitignore
+1
-0
1 addition, 0 deletions
server/.gitignore
server/app/dependencies.php
+12
-6
12 additions, 6 deletions
server/app/dependencies.php
server/cli-config.php
+22
-24
22 additions, 24 deletions
server/cli-config.php
with
35 additions
and
30 deletions
server/.gitignore
+
1
−
0
View file @
9420e3c5
...
...
@@ -3,6 +3,7 @@ nbproject/
.idea/
vendor/*
phpunit-coverage/
doctrine_cache/
coverage/
data/
build/*
...
...
This diff is collapsed.
Click to expand it.
server/app/dependencies.php
+
12
−
6
View file @
9420e3c5
...
...
@@ -22,10 +22,17 @@ $container->set('em', function (ContainerInterface $c) {
$settings
=
$c
->
get
(
SETTINGS
)[
'database'
];
$devMode
=
boolval
(
$settings
[
'dev_mode'
]);
$proxyDir
=
getcwd
()
.
'/../doctrine-proxy'
;
$cache
=
null
;
if
(
$devMode
==
false
)
{
$cache
=
new
\Doctrine\Common\Cache\ApcuCache
();
if
(
$devMode
)
{
$cache
=
\Doctrine\Common\Cache\Psr6\DoctrineProvider
::
wrap
(
new
\Symfony\Component\Cache\Adapter\ArrayAdapter
()
);
}
else
{
$cache
=
\Doctrine\Common\Cache\Psr6\DoctrineProvider
::
wrap
(
new
\Symfony\Component\Cache\Adapter\FilesystemAdapter
(
directory
:
'/project/doctrine_cache'
)
);
}
$dc
=
\Doctrine\ORM\Tools\Setup
::
createAnnotationMetadataConfiguration
(
array
(
'src/Entity'
),
$devMode
,
...
...
@@ -33,12 +40,11 @@ $container->set('em', function (ContainerInterface $c) {
$cache
);
$dc
->
setAutogenerateProxyClasses
(
false
);
if
(
$devMode
)
{
$dc
->
setSQLLogger
(
new
\Doctrine\DBAL\Logging\DebugStack
());
}
else
{
$dc
->
setQueryCacheImpl
(
$cache
);
}
return
\Doctrine\ORM\EntityManager
::
create
(
$settings
[
'connection_options'
],
$dc
);
});
...
...
This diff is collapsed.
Click to expand it.
server/cli-config.php
+
22
−
24
View file @
9420e3c5
<?php
// File needed by doctrine cli
require
'vendor/autoload.php'
;
$settings
=
require
'./app/settings.php'
;
$database
=
$settings
[
'database'
];
$devMode
=
boolval
(
$database
[
'dev_mode'
]);
$proxyDir
=
getcwd
()
.
'/doctrine-proxy'
;
$cache
=
null
;
if
(
$devMode
==
false
)
{
$cache
=
new
\Doctrine\Common\Cache\ApcuCache
();
}
/*
* This file is part of Anis Server.
*
* (c) Laboratoire d'Astrophysique de Marseille / CNRS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
declare
(
strict_types
=
1
);
$c
=
\Doctrine\ORM\Tools\Setup
::
createAnnotationMetadataConfiguration
(
array
(
'src/Entity'
),
$devMode
,
$proxyDir
,
$cache
);
$c
->
setAutoGenerateProxyClasses
(
false
);
use
DI\Container
;
use
Doctrine\ORM\Tools\Console\ConsoleRunner
;
if
(
$devMode
)
{
$c
->
setSQLLogger
(
new
\Doctrine\DBAL\Logging\DebugStack
());
}
else
{
$c
->
setQueryCacheImpl
(
$cache
);
}
// Autoloading for libraries
require
__DIR__
.
'/vendor/autoload.php'
;
$em
=
\Doctrine\ORM\EntityManager
::
create
(
$database
[
'connection_options'
],
$c
);
// Load app constants
require
__DIR__
.
'/app/constants.php'
;
return
\Doctrine\ORM\Tools\Console\ConsoleRunner
::
createHelperSet
(
$em
);
// Create Container using PHP-DI
$container
=
new
Container
();
// Setup dependencies
require
__DIR__
.
'/app/dependencies.php'
;
return
ConsoleRunner
::
createHelperSet
(
$container
->
get
(
'em'
));
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment