mirror of
https://github.com/wallabag/wallabag.git
synced 2024-12-23 16:10:28 +00:00
Merge pull request #7139 from yguedidi/fix-doctrine-deprecation-notices
Fix Doctrine deprecation notices
This commit is contained in:
commit
7fbf83f3bb
3 changed files with 10 additions and 4 deletions
|
@ -378,7 +378,7 @@ class InstallCommand extends Command
|
||||||
$databaseName = $connection->getDatabase();
|
$databaseName = $connection->getDatabase();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$schemaManager = $connection->getSchemaManager();
|
$schemaManager = $connection->createSchemaManager();
|
||||||
} catch (\Exception $exception) {
|
} catch (\Exception $exception) {
|
||||||
// mysql & sqlite
|
// mysql & sqlite
|
||||||
if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
|
if (false !== strpos($exception->getMessage(), sprintf("Unknown database '%s'", $databaseName))) {
|
||||||
|
@ -421,7 +421,7 @@ class InstallCommand extends Command
|
||||||
*/
|
*/
|
||||||
private function isSchemaPresent()
|
private function isSchemaPresent()
|
||||||
{
|
{
|
||||||
$schemaManager = $this->entityManager->getConnection()->getSchemaManager();
|
$schemaManager = $this->entityManager->getConnection()->createSchemaManager();
|
||||||
|
|
||||||
return \count($schemaManager->listTableNames()) > 0 ? true : false;
|
return \count($schemaManager->listTableNames()) > 0 ? true : false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ class SQLiteCascadeDeleteSubscriber implements EventSubscriber
|
||||||
*/
|
*/
|
||||||
public function preRemove(LifecycleEventArgs $args)
|
public function preRemove(LifecycleEventArgs $args)
|
||||||
{
|
{
|
||||||
$entity = $args->getEntity();
|
$entity = $args->getObject();
|
||||||
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof SqlitePlatform
|
if (!$this->doctrine->getConnection()->getDatabasePlatform() instanceof SqlitePlatform
|
||||||
|| !$entity instanceof Entry) {
|
|| !$entity instanceof Entry) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
namespace Wallabag\ImportBundle\Command;
|
namespace Wallabag\ImportBundle\Command;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Driver\Middleware;
|
||||||
|
use Doctrine\DBAL\Logging\Middleware as LoggingMiddleware;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Symfony\Component\Config\Definition\Exception\Exception;
|
use Symfony\Component\Config\Definition\Exception\Exception;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
|
@ -99,7 +101,11 @@ class ImportCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turning off doctrine default logs queries for saving memory
|
// Turning off doctrine default logs queries for saving memory
|
||||||
$this->entityManager->getConnection()->getConfiguration()->setSQLLogger(null);
|
$middlewares = $this->entityManager->getConnection()->getConfiguration()->getMiddlewares();
|
||||||
|
$middlewaresWithoutLogging = array_filter($middlewares, function (Middleware $middleware) {
|
||||||
|
return !$middleware instanceof LoggingMiddleware;
|
||||||
|
});
|
||||||
|
$this->entityManager->getConnection()->getConfiguration()->setMiddlewares($middlewaresWithoutLogging);
|
||||||
|
|
||||||
if ($input->getOption('useUserId')) {
|
if ($input->getOption('useUserId')) {
|
||||||
$entityUser = $this->userRepository->findOneById($input->getArgument('username'));
|
$entityUser = $this->userRepository->findOneById($input->getArgument('username'));
|
||||||
|
|
Loading…
Reference in a new issue