Updates preparing for Doctrine 3.0
- Switch to EntityManagerInterface for EM uses - Wrap EntityManager in close-resilient wrapper - Close/clear/reopen EM with every request - Rework tests to be em->clear() resilient.
This commit is contained in:
parent
85991b7546
commit
4bcfad3eb5
|
@ -89,9 +89,9 @@
|
|||
"flow/jsonpath": "^0.5",
|
||||
"mockery/mockery": "^1.0",
|
||||
"overtrue/phplint": "^1.1",
|
||||
"phpstan/phpstan": "^0.11.1",
|
||||
"phpstan/phpstan-doctrine": "^0.11.0",
|
||||
"phpstan/phpstan-strict-rules": "^0.11.0",
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpstan/phpstan-doctrine": "^0.12",
|
||||
"phpstan/phpstan-strict-rules": "^0.12",
|
||||
"phpunit/php-timer": "^3.1.4",
|
||||
"roave/security-advisories": "dev-master",
|
||||
"squizlabs/php_codesniffer": "3.*"
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "30fb1823a2fd210b7eb08ccbe9bab99c",
|
||||
"content-hash": "5ba7e8647fd9f110a7573d7999a5fac1",
|
||||
"packages": [
|
||||
{
|
||||
"name": "aws/aws-sdk-php",
|
||||
|
@ -10141,172 +10141,108 @@
|
|||
],
|
||||
"time": "2020-03-05T15:02:03+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpdoc-parser",
|
||||
"version": "0.3.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpdoc-parser.git",
|
||||
"reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/8c4ef2aefd9788238897b678a985e1d5c8df6db4",
|
||||
"reference": "8c4ef2aefd9788238897b678a985e1d5c8df6db4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "~7.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"consistence/coding-standard": "^3.5",
|
||||
"jakub-onderka/php-parallel-lint": "^0.9.2",
|
||||
"phing/phing": "^2.16.0",
|
||||
"phpstan/phpstan": "^0.10",
|
||||
"phpunit/phpunit": "^6.3",
|
||||
"slevomat/coding-standard": "^4.7.2",
|
||||
"squizlabs/php_codesniffer": "^3.3.2",
|
||||
"symfony/process": "^3.4 || ^4.0"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.3-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\PhpDocParser\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPDoc parser with support for nullable, intersection and generic types",
|
||||
"time": "2019-06-07T19:13:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "0.11.19",
|
||||
"version": "0.12.31",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7"
|
||||
"reference": "776c8056b401e1b67f277b9e9fb334d1a274671d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/63cc502f6957b7f74efbac444b4cf219dcadffd7",
|
||||
"reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/776c8056b401e1b67f277b9e9fb334d1a274671d",
|
||||
"reference": "776c8056b401e1b67f277b9e9fb334d1a274671d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer/xdebug-handler": "^1.3.0",
|
||||
"jean85/pretty-package-versions": "^1.0.3",
|
||||
"nette/bootstrap": "^2.4 || ^3.0",
|
||||
"nette/di": "^2.4.7 || ^3.0",
|
||||
"nette/neon": "^2.4.3 || ^3.0",
|
||||
"nette/robot-loader": "^3.0.1",
|
||||
"nette/schema": "^1.0",
|
||||
"nette/utils": "^2.4.5 || ^3.0",
|
||||
"nikic/php-parser": "^4.2.3",
|
||||
"php": "~7.1",
|
||||
"phpstan/phpdoc-parser": "^0.3.5",
|
||||
"symfony/console": "~3.2 || ~4.0",
|
||||
"symfony/finder": "~3.2 || ~4.0"
|
||||
"php": "^7.1"
|
||||
},
|
||||
"conflict": {
|
||||
"symfony/console": "3.4.16 || 4.1.5"
|
||||
},
|
||||
"require-dev": {
|
||||
"brianium/paratest": "^2.0 || ^3.0",
|
||||
"consistence/coding-standard": "^3.5",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
|
||||
"ext-intl": "*",
|
||||
"ext-mysqli": "*",
|
||||
"ext-simplexml": "*",
|
||||
"ext-soap": "*",
|
||||
"ext-zip": "*",
|
||||
"jakub-onderka/php-parallel-lint": "^1.0",
|
||||
"localheinz/composer-normalize": "^1.1.0",
|
||||
"phing/phing": "^2.16.0",
|
||||
"phpstan/phpstan-deprecation-rules": "^0.11",
|
||||
"phpstan/phpstan-php-parser": "^0.11",
|
||||
"phpstan/phpstan-phpunit": "^0.11",
|
||||
"phpstan/phpstan-strict-rules": "^0.11",
|
||||
"phpunit/phpunit": "^7.5.14 || ^8.0",
|
||||
"slevomat/coding-standard": "^4.7.2",
|
||||
"squizlabs/php_codesniffer": "^3.3.2"
|
||||
"phpstan/phpstan-shim": "*"
|
||||
},
|
||||
"bin": [
|
||||
"bin/phpstan"
|
||||
"phpstan",
|
||||
"phpstan.phar"
|
||||
],
|
||||
"type": "library",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.11-dev"
|
||||
"dev-master": "0.12-dev"
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PHPStan\\": [
|
||||
"src/"
|
||||
]
|
||||
}
|
||||
"files": [
|
||||
"bootstrap.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"description": "PHPStan - PHP Static Analysis Tool",
|
||||
"time": "2019-10-22T20:20:22+00:00"
|
||||
"funding": [
|
||||
{
|
||||
"url": "https://github.com/ondrejmirtes",
|
||||
"type": "github"
|
||||
},
|
||||
{
|
||||
"url": "https://www.patreon.com/phpstan",
|
||||
"type": "patreon"
|
||||
},
|
||||
{
|
||||
"url": "https://tidelift.com/funding/github/packagist/phpstan/phpstan",
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2020-06-24T20:55:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-doctrine",
|
||||
"version": "0.11.6",
|
||||
"version": "0.12.17",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-doctrine.git",
|
||||
"reference": "77592865e167b32c7dcb4f39a35210e909a8854c"
|
||||
"reference": "5eed42b2815f100f25bd45fe8c1a9b01f3e41657"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/77592865e167b32c7dcb4f39a35210e909a8854c",
|
||||
"reference": "77592865e167b32c7dcb4f39a35210e909a8854c",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-doctrine/zipball/5eed42b2815f100f25bd45fe8c1a9b01f3e41657",
|
||||
"reference": "5eed42b2815f100f25bd45fe8c1a9b01f3e41657",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"nikic/php-parser": "^4.0",
|
||||
"php": "~7.1",
|
||||
"phpstan/phpdoc-parser": "^0.3",
|
||||
"phpstan/phpstan": "^0.11.7"
|
||||
"phpstan/phpstan": "^0.12.26"
|
||||
},
|
||||
"conflict": {
|
||||
"doctrine/collections": "<1.0",
|
||||
"doctrine/common": "<2.7",
|
||||
"doctrine/mongodb-odm": "<1.2",
|
||||
"doctrine/orm": "<2.5"
|
||||
"doctrine/orm": "<2.5",
|
||||
"doctrine/persistence": "<1.3"
|
||||
},
|
||||
"require-dev": {
|
||||
"consistence/coding-standard": "^3.8",
|
||||
"consistence/coding-standard": "^3.0.1",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
|
||||
"doctrine/collections": "^1.0",
|
||||
"doctrine/common": "^2.7",
|
||||
"doctrine/mongodb-odm": "^1.2",
|
||||
"doctrine/common": "^2.7 || ^3.0",
|
||||
"doctrine/mongodb-odm": "^1.3 || ^2.1",
|
||||
"doctrine/orm": "^2.5",
|
||||
"doctrine/persistence": "^1.1 || ^2.0",
|
||||
"ergebnis/composer-normalize": "^2.0.2",
|
||||
"jakub-onderka/php-parallel-lint": "^1.0",
|
||||
"phing/phing": "^2.16.0",
|
||||
"phpstan/phpstan-phpunit": "^0.11",
|
||||
"phpstan/phpstan-strict-rules": "^0.11",
|
||||
"phpstan/phpstan-phpunit": "^0.12",
|
||||
"phpstan/phpstan-strict-rules": "^0.12",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"slevomat/coding-standard": "^5.0.4"
|
||||
"ramsey/uuid-doctrine": "^1.5.0",
|
||||
"slevomat/coding-standard": "^4.5.2"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.11-dev"
|
||||
"dev-master": "0.12-dev"
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
|
@ -10325,40 +10261,40 @@
|
|||
"MIT"
|
||||
],
|
||||
"description": "Doctrine extensions for PHPStan",
|
||||
"time": "2019-09-13T08:40:06+00:00"
|
||||
"time": "2020-06-23T08:50:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-strict-rules",
|
||||
"version": "0.11.1",
|
||||
"version": "0.12.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
|
||||
"reference": "a203a7afdda073d4ea405a6d9007a5b32de3be61"
|
||||
"reference": "a670a59aff7cf96f75d21b974860ada10e25b2ee"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/a203a7afdda073d4ea405a6d9007a5b32de3be61",
|
||||
"reference": "a203a7afdda073d4ea405a6d9007a5b32de3be61",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/a670a59aff7cf96f75d21b974860ada10e25b2ee",
|
||||
"reference": "a670a59aff7cf96f75d21b974860ada10e25b2ee",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"nikic/php-parser": "^4.0",
|
||||
"php": "~7.1",
|
||||
"phpstan/phpstan": "^0.11.4"
|
||||
"phpstan/phpstan": "^0.12.6"
|
||||
},
|
||||
"require-dev": {
|
||||
"consistence/coding-standard": "^3.0.1",
|
||||
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
|
||||
"ergebnis/composer-normalize": "^2.0.2",
|
||||
"jakub-onderka/php-parallel-lint": "^1.0",
|
||||
"phing/phing": "^2.16.0",
|
||||
"phpstan/phpstan-phpunit": "^0.11",
|
||||
"phpstan/phpstan-phpunit": "^0.12",
|
||||
"phpunit/phpunit": "^7.0",
|
||||
"slevomat/coding-standard": "^4.5.2"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-master": "0.11-dev"
|
||||
"dev-master": "0.12-dev"
|
||||
},
|
||||
"phpstan": {
|
||||
"includes": [
|
||||
|
@ -10376,7 +10312,7 @@
|
|||
"MIT"
|
||||
],
|
||||
"description": "Extra strict and opinionated rules for PHPStan",
|
||||
"time": "2019-05-12T16:59:47+00:00"
|
||||
"time": "2020-01-20T13:08:52+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
|
|
@ -23,8 +23,8 @@ return function (\App\EventDispatcher $dispatcher) {
|
|||
Doctrine\ORM\Tools\Console\ConsoleRunner::addCommands($console);
|
||||
|
||||
// Add Doctrine Migrations
|
||||
/** @var Doctrine\ORM\EntityManager $em */
|
||||
$em = $di->get(Doctrine\ORM\EntityManager::class);
|
||||
/** @var Doctrine\ORM\EntityManagerInterface $em */
|
||||
$em = $di->get(Doctrine\ORM\EntityManagerInterface::class);
|
||||
|
||||
$helper_set = $console->getHelperSet();
|
||||
$doctrine_helpers = Doctrine\ORM\Tools\Console\ConsoleRunner::createHelperSet($em);
|
||||
|
@ -73,6 +73,9 @@ return function (\App\EventDispatcher $dispatcher) {
|
|||
$app->add(Middleware\InjectRouter::class);
|
||||
$app->add(Middleware\InjectRateLimit::class);
|
||||
|
||||
// Re-establish database connection if multiple requests are handled by the same stack.
|
||||
$app->add(Middleware\ReopenEntityManagerMiddleware::class);
|
||||
|
||||
// System middleware for routing and body parsing.
|
||||
$app->addBodyParsingMiddleware();
|
||||
$app->addRoutingMiddleware();
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
*/
|
||||
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
||||
return [
|
||||
|
@ -49,13 +48,12 @@ return [
|
|||
},
|
||||
|
||||
// DBAL
|
||||
Doctrine\DBAL\Connection::class => function (Doctrine\ORM\EntityManager $em) {
|
||||
Doctrine\DBAL\Connection::class => function (Doctrine\ORM\EntityManagerInterface $em) {
|
||||
return $em->getConnection();
|
||||
},
|
||||
'db' => DI\Get(Doctrine\DBAL\Connection::class),
|
||||
|
||||
// Doctrine Entity Manager
|
||||
Doctrine\ORM\EntityManager::class => function (
|
||||
App\Doctrine\DecoratedEntityManager::class => function (
|
||||
Doctrine\Common\Cache\Cache $doctrineCache,
|
||||
Doctrine\Common\Annotations\Reader $reader,
|
||||
App\Settings $settings,
|
||||
|
@ -112,12 +110,18 @@ return [
|
|||
$eventManager->addEventSubscriber($eventRequiresRestart);
|
||||
$eventManager->addEventSubscriber($eventAuditLog);
|
||||
|
||||
return Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager);
|
||||
return new App\Doctrine\DecoratedEntityManager(function () use (
|
||||
$connectionOptions,
|
||||
$config,
|
||||
$eventManager
|
||||
) {
|
||||
return Doctrine\ORM\EntityManager::create($connectionOptions, $config, $eventManager);
|
||||
});
|
||||
} catch (Exception $e) {
|
||||
throw new App\Exception\BootstrapException($e->getMessage());
|
||||
}
|
||||
},
|
||||
'em' => DI\Get(Doctrine\ORM\EntityManager::class),
|
||||
Doctrine\ORM\EntityManagerInterface::class => DI\Get(App\Doctrine\DecoratedEntityManager::class),
|
||||
|
||||
// Cache
|
||||
Psr\Cache\CacheItemPoolInterface::class => function (App\Settings $settings, Psr\Container\ContainerInterface $di) {
|
||||
|
@ -284,7 +288,7 @@ return [
|
|||
// Symfony Serializer
|
||||
Symfony\Component\Serializer\Serializer::class => function (
|
||||
Doctrine\Common\Annotations\Reader $annotation_reader,
|
||||
Doctrine\ORM\EntityManager $em
|
||||
Doctrine\ORM\EntityManagerInterface $em
|
||||
) {
|
||||
$meta_factory = new Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory(
|
||||
new Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader($annotation_reader)
|
||||
|
@ -316,7 +320,7 @@ return [
|
|||
Redis $redis,
|
||||
ContainerInterface $di,
|
||||
Monolog\Logger $logger,
|
||||
EntityManager $em
|
||||
Doctrine\ORM\EntityManagerInterface $em
|
||||
) {
|
||||
// Build QueueFactory
|
||||
$driver = new Bernard\Driver\PhpRedis\Driver($redis);
|
||||
|
|
|
@ -4,7 +4,8 @@ parameters:
|
|||
paths:
|
||||
- src
|
||||
|
||||
bootstrap: %rootDir%/../../../util/phpstan.php
|
||||
bootstrapFiles:
|
||||
- %rootDir%/../../../util/phpstan.php
|
||||
|
||||
universalObjectCratesClasses:
|
||||
- App\Session\NamespaceInterface
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace App;
|
|||
|
||||
use App\Entity\Station;
|
||||
use App\Http\Router;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use GuzzleHttp\Psr7\UriResolver;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
|
||||
|
@ -13,13 +13,13 @@ use Psr\Http\Message\UriInterface;
|
|||
*/
|
||||
class ApiUtilities
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Router $router;
|
||||
|
||||
protected Customization $customization;
|
||||
|
||||
public function __construct(EntityManager $em, Router $router, Customization $customization)
|
||||
public function __construct(EntityManagerInterface $em, Router $router, Customization $customization)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->router = $router;
|
||||
|
|
|
@ -4,7 +4,6 @@ namespace App;
|
|||
use App\Entity\Repository\UserRepository;
|
||||
use App\Entity\User;
|
||||
use App\Exception\NotLoggedInException;
|
||||
use App\Exception;
|
||||
use Mezzio\Session\SessionInterface;
|
||||
|
||||
class Auth
|
||||
|
@ -170,7 +169,7 @@ class Auth
|
|||
}
|
||||
|
||||
return ($this->user instanceof User)
|
||||
? $this->user
|
||||
? $this->userRepo->getRepository()->find($this->user->getId())
|
||||
: null;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ namespace App\Console\Command;
|
|||
use App\Entity;
|
||||
use App\Sync\Task\Backup;
|
||||
use App\Utilities;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InfluxDB\Database;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
use const PATHINFO_EXTENSION;
|
||||
|
@ -16,7 +15,7 @@ class BackupCommand extends CommandAbstract
|
|||
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Database $influxdb,
|
||||
?string $path = '',
|
||||
bool $excludeMedia = false
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
namespace App\Console\Command\Internal;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Entity;
|
||||
use App\Radio\Adapters;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class DjAuthCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Adapters $adapters,
|
||||
int $stationId,
|
||||
string $djUser = '',
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
namespace App\Console\Command\Internal;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Entity;
|
||||
use App\Radio\Adapters;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class DjOffCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Adapters $adapters,
|
||||
int $stationId,
|
||||
string $djUser = ''
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
namespace App\Console\Command\Internal;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Entity;
|
||||
use App\Radio\Adapters;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class DjOnCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Adapters $adapters,
|
||||
int $stationId,
|
||||
string $djUser = ''
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
namespace App\Console\Command\Internal;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Entity;
|
||||
use App\Sync\Task\NowPlaying;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
|
@ -12,7 +12,7 @@ class FeedbackCommand extends CommandAbstract
|
|||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
NowPlaying $nowPlaying,
|
||||
int $stationId,
|
||||
string $song = null,
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
namespace App\Console\Command\Internal;
|
||||
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Entity;
|
||||
use App\Radio\AutoDJ;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class NextSongCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
AutoDJ $autoDJ,
|
||||
int $stationId,
|
||||
bool $asAutodj = false
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
namespace App\Console\Command\Internal;
|
||||
|
||||
use App\Entity\SftpUser;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use App\Entity\SftpUser;
|
||||
use Brick\Math\BigInteger;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class SftpAuthCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$username = getenv('SFTPGO_AUTHD_USERNAME');
|
||||
$password = getenv('SFTPGO_AUTHD_PASSWORD');
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Entity;
|
|||
use App\Flysystem\Filesystem;
|
||||
use App\Message;
|
||||
use App\MessageQueue;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
|
@ -14,7 +14,7 @@ class SftpUploadCommand extends CommandAbstract
|
|||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationRepository $stationRepo,
|
||||
LoggerInterface $logger,
|
||||
Filesystem $filesystem,
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
namespace App\Console\Command;
|
||||
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class ListUsersCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em
|
||||
EntityManagerInterface $em
|
||||
) {
|
||||
$io->title('AzuraCast User Accounts');
|
||||
|
||||
|
|
|
@ -4,8 +4,7 @@ namespace App\Console\Command;
|
|||
use App\Entity;
|
||||
use App\Entity\Repository\StationRepository;
|
||||
use App\Entity\Station;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
|
@ -13,7 +12,7 @@ class ReprocessMediaCommand extends CommandAbstract
|
|||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
StationRepository $stationRepo,
|
||||
Entity\Repository\StationMediaRepository $media_repo,
|
||||
?string $stationName = null
|
||||
|
|
|
@ -3,15 +3,14 @@ namespace App\Console\Command;
|
|||
|
||||
use App\Entity;
|
||||
use App\Utilities;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class ResetPasswordCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
string $email
|
||||
) {
|
||||
$io->title('Reset Account Password');
|
||||
|
|
|
@ -4,14 +4,14 @@ namespace App\Console\Command;
|
|||
use App\Entity\Repository\StationRepository;
|
||||
use App\Entity\Station;
|
||||
use App\Radio\Configuration;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class RestartRadioCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
StationRepository $stationRepo,
|
||||
Configuration $configuration,
|
||||
?string $stationName = null
|
||||
|
|
|
@ -3,7 +3,7 @@ namespace App\Console\Command;
|
|||
|
||||
use App\Sync\Task\Backup;
|
||||
use App\Utilities;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InfluxDB\Database;
|
||||
use Symfony\Component\Console\Output\OutputInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
@ -16,7 +16,7 @@ class RestoreCommand extends CommandAbstract
|
|||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
OutputInterface $output,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Database $influxdb,
|
||||
string $path
|
||||
) {
|
||||
|
|
|
@ -3,15 +3,14 @@ namespace App\Console\Command;
|
|||
|
||||
use App\Acl;
|
||||
use App\Entity;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||
|
||||
class SetAdministratorCommand extends CommandAbstract
|
||||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\RolePermissionRepository $perms_repo,
|
||||
string $email
|
||||
) {
|
||||
|
|
|
@ -3,12 +3,11 @@ namespace App\Console\Command;
|
|||
|
||||
use App\Entity\Station;
|
||||
use App\Settings;
|
||||
use App\Console\Command\CommandAbstract;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
|
||||
use Doctrine\Common\DataFixtures\Loader;
|
||||
use Doctrine\Common\DataFixtures\Purger\ORMPurger;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InfluxDB\Database;
|
||||
use InfluxDB\Point;
|
||||
use Psr\Container\ContainerInterface;
|
||||
|
@ -20,7 +19,7 @@ class SetupFixturesCommand extends CommandAbstract
|
|||
{
|
||||
public function __invoke(
|
||||
SymfonyStyle $io,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
ContainerInterface $di,
|
||||
Database $influx,
|
||||
Settings $settings
|
||||
|
|
|
@ -4,14 +4,14 @@ namespace App\Controller\Admin;
|
|||
use App\Exception\NotFoundException;
|
||||
use App\Form\EntityForm;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
|
||||
abstract class AbstractAdminCrudController
|
||||
{
|
||||
protected EntityForm $form;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected string $entity_class;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\Http\ServerRequest;
|
|||
use App\Radio\AutoDJ;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Sync\Runner;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Monolog\Handler\TestHandler;
|
||||
use Monolog\Logger;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
@ -75,7 +75,7 @@ class DebugController
|
|||
public function nextsongAction(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
AutoDJ $autoDJ
|
||||
): ResponseInterface {
|
||||
$this->logger->pushHandler($this->testHandler);
|
||||
|
@ -92,7 +92,7 @@ class DebugController
|
|||
$this->logger->debug('Current queue cleared.');
|
||||
|
||||
$autoDJ->buildQueue($station);
|
||||
|
||||
|
||||
$this->logger->popHandler();
|
||||
|
||||
return $request->getView()->renderToResponse($response, 'system/log_view', [
|
||||
|
|
|
@ -7,14 +7,14 @@ use App\Exception;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class LogsController extends AbstractLogViewerController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
public function __construct(EntityManager $em)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ namespace App\Controller\Admin;
|
|||
use App\Entity;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class RelaysController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
public function __construct(EntityManager $em)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Exception\ValidationException;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Utilities;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Doctrine\ORM\Query;
|
||||
|
@ -18,7 +18,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
|
||||
abstract class AbstractApiCrudController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Serializer $serializer;
|
||||
|
||||
|
@ -30,7 +30,7 @@ abstract class AbstractApiCrudController
|
|||
/** @var string The route name used to generate the "self" links for each record. */
|
||||
protected string $resourceRouteName;
|
||||
|
||||
public function __construct(EntityManager $em, Serializer $serializer, ValidatorInterface $validator)
|
||||
public function __construct(EntityManagerInterface $em, Serializer $serializer, ValidatorInterface $validator)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->serializer = $serializer;
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
<?php
|
||||
namespace App\Controller\Api\Admin;
|
||||
|
||||
use App\Doctrine\Paginator;
|
||||
use App\Entity;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Doctrine\Paginator;
|
||||
use Cake\Chronos\Chronos;
|
||||
use DateTimeZone;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use const JSON_PRETTY_PRINT;
|
||||
|
||||
class AuditLogController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
public function __construct(EntityManager $em)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
|
|
@ -6,18 +6,18 @@ use App\Entity;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Adapters;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class RelaysController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Adapters $adapters;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Adapters $adapters
|
||||
) {
|
||||
$this->em = $em;
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Entity;
|
|||
use App\Exception\ValidationException;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
|
||||
|
@ -14,7 +14,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
|
||||
class SettingsController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Serializer $serializer;
|
||||
|
||||
|
@ -25,7 +25,7 @@ class SettingsController
|
|||
protected Entity\Api\Admin\Settings $api_settings;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settings_repo,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Controller\Api\Admin;
|
|||
use App\Entity;
|
||||
use App\Exception\ValidationException;
|
||||
use App\Normalizer\DoctrineEntityNormalizer;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
|
@ -18,7 +18,7 @@ class StationsController extends AbstractAdminApiCrudController
|
|||
protected Entity\Repository\StationRepository $station_repo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Entity\Repository\StationRepository $station_repo
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Event\Radio\LoadNowPlaying;
|
|||
use App\EventDispatcher;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
@ -14,7 +14,7 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|||
|
||||
class NowplayingController implements EventSubscriberInterface
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
|
@ -23,7 +23,7 @@ class NowplayingController implements EventSubscriberInterface
|
|||
protected EventDispatcher $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
CacheInterface $cache,
|
||||
EventDispatcher $dispatcher
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Entity;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
@ -15,7 +15,7 @@ abstract class AbstractScheduledEntityController extends AbstractStationApiCrudC
|
|||
protected Entity\Repository\StationScheduleRepository $scheduleRepo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Entity\Repository\StationScheduleRepository $scheduleRepo
|
||||
|
|
|
@ -9,7 +9,7 @@ use App\Http\ServerRequest;
|
|||
use App\Message\WritePlaylistFileMessage;
|
||||
use App\MessageQueue;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
|
@ -18,7 +18,7 @@ class BatchAction
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationMediaRepository $mediaRepo,
|
||||
Entity\Repository\StationPlaylistMediaRepository $playlistMediaRepo,
|
||||
Entity\Repository\StationPlaylistFolderRepository $playlistFolderRepo,
|
||||
|
@ -55,7 +55,7 @@ class BatchAction
|
|||
$music_files = $this->getMusicFiles($fs, $files);
|
||||
$files_found = count($music_files);
|
||||
|
||||
/** @var Entity\StationPlaylist[] $playlists */
|
||||
/** @var Entity\StationPlaylist[] $affected_playlists */
|
||||
$affected_playlists = [];
|
||||
|
||||
foreach ($music_files as $file) {
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Entity;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Service\Flow;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Error;
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
@ -15,7 +15,7 @@ class FlowUploadAction
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationMediaRepository $mediaRepo,
|
||||
Entity\Repository\StationPlaylistMediaRepository $spmRepo
|
||||
): ResponseInterface {
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\Flysystem\Filesystem;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Utilities;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use const SORT_ASC;
|
||||
use const SORT_DESC;
|
||||
|
@ -17,7 +17,7 @@ class ListAction
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Filesystem $filesystem,
|
||||
Customization $customization
|
||||
): ResponseInterface {
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Entity;
|
|||
use App\Flysystem\Filesystem;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class RenameAction
|
||||
|
@ -14,7 +14,7 @@ class RenameAction
|
|||
ServerRequest $request,
|
||||
Response $response,
|
||||
Filesystem $filesystem,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationMediaRepository $mediaRepo
|
||||
): ResponseInterface {
|
||||
$originalPath = $request->getAttribute('file');
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Message\WritePlaylistFileMessage;
|
|||
use App\MessageQueue;
|
||||
use App\Radio\Adapters;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
@ -38,7 +38,7 @@ class FilesController extends AbstractStationApiCrudController
|
|||
protected Entity\Repository\StationPlaylistMediaRepository $playlist_media_repo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Filesystem $filesystem,
|
||||
|
@ -271,7 +271,7 @@ class FilesController extends AbstractStationApiCrudController
|
|||
if (null !== $playlists) {
|
||||
$station = $record->getStation();
|
||||
|
||||
/** @var Entity\StationPlaylist[] $playlists */
|
||||
/** @var Entity\StationPlaylist[] $affected_playlists */
|
||||
$affected_playlists = [];
|
||||
|
||||
// Remove existing playlists.
|
||||
|
@ -288,13 +288,13 @@ class FilesController extends AbstractStationApiCrudController
|
|||
$playlist_id = $new_playlist['id'];
|
||||
$playlist_weight = $new_playlist['weight'] ?? 0;
|
||||
} else {
|
||||
$playlist_id = $new_playlist;
|
||||
$playlist_id = (int)$new_playlist;
|
||||
$playlist_weight = 0;
|
||||
}
|
||||
|
||||
$playlist = $this->em->getRepository(Entity\StationPlaylist::class)->findOneBy([
|
||||
'station_id' => $station->getId(),
|
||||
'id' => (int)$playlist_id,
|
||||
'id' => $playlist_id,
|
||||
]);
|
||||
|
||||
if ($playlist instanceof Entity\StationPlaylist) {
|
||||
|
@ -330,7 +330,7 @@ class FilesController extends AbstractStationApiCrudController
|
|||
|
||||
$station = $record->getStation();
|
||||
|
||||
/** @var Entity\StationPlaylist[] $playlists */
|
||||
/** @var Entity\StationPlaylist[] $affected_playlists */
|
||||
$affected_playlists = [];
|
||||
|
||||
$media_playlists = $this->playlist_media_repo->clearPlaylistsFromMedia($record);
|
||||
|
|
|
@ -9,17 +9,17 @@ use App\Http\ServerRequest;
|
|||
use App\Utilities\Csv;
|
||||
use Cake\Chronos\Chronos;
|
||||
use DateTimeZone;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class HistoryController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected App\ApiUtilities $api_utils;
|
||||
|
||||
public function __construct(EntityManager $em, App\ApiUtilities $api_utils)
|
||||
public function __construct(EntityManagerInterface $em, App\ApiUtilities $api_utils)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->api_utils = $api_utils;
|
||||
|
|
|
@ -7,17 +7,17 @@ use App\Exception\NotFoundException;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Adapters;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class IndexController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Adapters $adapters;
|
||||
|
||||
public function __construct(EntityManager $em, Adapters $adapters)
|
||||
public function __construct(EntityManagerInterface $em, Adapters $adapters)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->adapters = $adapters;
|
||||
|
|
|
@ -8,18 +8,18 @@ use App\Service\IpGeolocation;
|
|||
use App\Utilities\Csv;
|
||||
use Cake\Chronos\Chronos;
|
||||
use DateTimeZone;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Mobile_Detect;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ListenersController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected IpGeolocation $geoLite;
|
||||
|
||||
public function __construct(EntityManager $em, IpGeolocation $geoLite)
|
||||
public function __construct(EntityManagerInterface $em, IpGeolocation $geoLite)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->geoLite = $geoLite;
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\Entity;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Utilities;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ListAction
|
||||
|
@ -15,7 +15,7 @@ class ListAction
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
ApiUtilities $apiUtils
|
||||
): ResponseInterface {
|
||||
$station = $request->getStation();
|
||||
|
|
|
@ -5,7 +5,7 @@ use App;
|
|||
use App\Entity;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
@ -20,7 +20,7 @@ class QueueController extends AbstractStationApiCrudController
|
|||
protected App\ApiUtilities $apiUtils;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
App\ApiUtilities $apiUtils
|
||||
|
|
|
@ -8,20 +8,20 @@ use App\Exception;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Utilities;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class RequestsController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\StationRequestRepository $requestRepo;
|
||||
|
||||
protected ApiUtilities $api_utils;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationRequestRepository $requestRepo,
|
||||
ApiUtilities $api_utils
|
||||
) {
|
||||
|
@ -163,7 +163,7 @@ class RequestsController
|
|||
} catch (Exception\InvalidRequestAttribute $e) {
|
||||
$user = null;
|
||||
}
|
||||
|
||||
|
||||
$isAuthenticated = ($user instanceof Entity\User);
|
||||
|
||||
try {
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Entity\Repository\StationScheduleRepository;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
@ -42,7 +42,7 @@ class ScheduleController extends AbstractStationApiCrudController
|
|||
*
|
||||
* @param ServerRequest $request
|
||||
* @param Response $response
|
||||
* @param EntityManager $em
|
||||
* @param EntityManagerInterface $em
|
||||
* @param CacheInterface $cache
|
||||
* @param StationScheduleRepository $scheduleRepo
|
||||
*
|
||||
|
@ -51,7 +51,7 @@ class ScheduleController extends AbstractStationApiCrudController
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
CacheInterface $cache,
|
||||
StationScheduleRepository $scheduleRepo
|
||||
): ResponseInterface {
|
||||
|
|
|
@ -8,17 +8,17 @@ use App\Http\ServerRequest;
|
|||
use App\Radio\AutoDJ;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Radio\Configuration;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OpenApi\Annotations as OA;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ServicesController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Configuration $configuration;
|
||||
|
||||
public function __construct(EntityManager $em, Configuration $configuration)
|
||||
public function __construct(EntityManagerInterface $em, Configuration $configuration)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->configuration = $configuration;
|
||||
|
|
|
@ -11,7 +11,7 @@ use App\Http\Response;
|
|||
use App\Http\ServerRequest;
|
||||
use App\RateLimit;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class LoginAction
|
||||
|
@ -21,7 +21,7 @@ class LoginAction
|
|||
Response $response,
|
||||
Acl $acl,
|
||||
Auth $auth,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
RateLimit $rateLimit,
|
||||
SettingsRepository $settingsRepo
|
||||
): ResponseInterface {
|
||||
|
@ -65,7 +65,7 @@ class LoginAction
|
|||
if (!$auth->isLoginComplete()) {
|
||||
return $response->withRedirect($request->getRouter()->named('account:login:2fa'));
|
||||
}
|
||||
|
||||
|
||||
// Redirect to complete setup if it's not completed yet.
|
||||
if ($settingsRepo->getSetting(Settings::SETUP_COMPLETE, 0) === 0) {
|
||||
$flash->addMessage('<b>' . __('Logged in successfully.') . '</b><br>' . __('Complete the setup process to get started.'),
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
<?php
|
||||
namespace App\Controller\Frontend;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Exception\NotFoundException;
|
||||
use App\Form\Form;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ApiKeysController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected string $csrf_namespace = 'frontend_api_keys';
|
||||
|
||||
|
@ -20,8 +20,11 @@ class ApiKeysController
|
|||
|
||||
protected array $form_config;
|
||||
|
||||
public function __construct(EntityManager $em, Entity\Repository\ApiKeyRepository $apiKeyRepository, Config $config)
|
||||
{
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\ApiKeyRepository $apiKeyRepository,
|
||||
Config $config
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->record_repo = $apiKeyRepository;
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use App\Http\Response;
|
|||
use App\Http\Router;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Adapters;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InfluxDB\Database;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
@ -17,7 +17,7 @@ use stdClass;
|
|||
|
||||
class DashboardController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
|
@ -34,7 +34,7 @@ class DashboardController
|
|||
protected EventDispatcher $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Acl $acl,
|
||||
CacheInterface $cache,
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Controller\Frontend\Profile;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class DisableTwoFactorAction
|
||||
|
@ -12,7 +12,7 @@ class DisableTwoFactorAction
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em
|
||||
EntityManagerInterface $em
|
||||
): ResponseInterface {
|
||||
$user = $request->getUser();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ use App\Http\ServerRequest;
|
|||
use App\Session\Flash;
|
||||
use AzuraForms\Field\AbstractField;
|
||||
use BaconQrCode;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use OTPHP\TOTP;
|
||||
use ParagonIE\ConstantTime\Base32;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
@ -20,7 +20,7 @@ class EnableTwoFactorAction
|
|||
ServerRequest $request,
|
||||
Response $response,
|
||||
Config $config,
|
||||
EntityManager $em
|
||||
EntityManagerInterface $em
|
||||
): ResponseInterface {
|
||||
$twoFactorFormConfig = $config->get('forms/profile_two_factor');
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Exception\StationNotFoundException;
|
|||
use App\Exception\StationUnsupportedException;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class OnDemandAction
|
||||
|
@ -13,7 +13,7 @@ class OnDemandAction
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
bool $embed = false
|
||||
): ResponseInterface {
|
||||
// Override system-wide iframe refusal
|
||||
|
|
|
@ -9,14 +9,14 @@ use App\Form\SettingsForm;
|
|||
use App\Form\StationForm;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Settings;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class SetupController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
|
@ -27,7 +27,7 @@ class SetupController
|
|||
protected Settings $settings;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepository,
|
||||
Auth $auth,
|
||||
Acl $acl,
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\Exception\CsrfValidationException;
|
|||
use App\Exception\NotFoundException;
|
||||
use App\Form\EntityForm;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\OptimisticLockException;
|
||||
use Doctrine\ORM\ORMException;
|
||||
|
@ -16,7 +16,7 @@ abstract class AbstractStationCrudController
|
|||
{
|
||||
protected EntityForm $form;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected string $entity_class;
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
<?php
|
||||
namespace App\Controller\Stations;
|
||||
|
||||
use App\Config;
|
||||
use App\Form\Form;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Session\Flash;
|
||||
use App\Settings;
|
||||
use App\Sync\Task\RadioAutomation;
|
||||
use App\Config;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class AutomationController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected RadioAutomation $sync_task;
|
||||
|
||||
|
@ -23,7 +23,7 @@ class AutomationController
|
|||
protected array $form_config;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
RadioAutomation $sync_task,
|
||||
Settings $app_settings,
|
||||
Config $config
|
||||
|
|
|
@ -8,7 +8,7 @@ use App\Http\ServerRequest;
|
|||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Session\Flash;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class EditLiquidsoapConfigController
|
||||
|
@ -16,7 +16,7 @@ class EditLiquidsoapConfigController
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Settings $settings
|
||||
): ResponseInterface {
|
||||
$station = $request->getStation();
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\Entity;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Service\SftpGo;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class FilesController
|
||||
|
@ -13,7 +13,7 @@ class FilesController
|
|||
public function __invoke(
|
||||
ServerRequest $request,
|
||||
Response $response,
|
||||
EntityManager $em
|
||||
EntityManagerInterface $em
|
||||
): ResponseInterface {
|
||||
$station = $request->getStation();
|
||||
|
||||
|
|
|
@ -5,12 +5,12 @@ use App\Entity;
|
|||
use App\Form\StationForm;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class ProfileController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\StationRepository $station_repo;
|
||||
|
||||
|
@ -19,7 +19,7 @@ class ProfileController
|
|||
protected string $csrf_namespace = 'stations_profile';
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationRepository $station_repo,
|
||||
StationForm $station_form
|
||||
) {
|
||||
|
|
|
@ -6,19 +6,19 @@ use App\Flysystem\Filesystem;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class DuplicatesController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\StationMediaRepository $mediaRepo;
|
||||
|
||||
protected Filesystem $filesystem;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\StationMediaRepository $mediaRepo,
|
||||
Filesystem $filesystem
|
||||
) {
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Http\Response;
|
|||
use App\Http\ServerRequest;
|
||||
use Cake\Chronos\Chronos;
|
||||
use DateTimeZone;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InfluxDB\Database;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use stdClass;
|
||||
|
@ -15,14 +15,17 @@ use function array_slice;
|
|||
|
||||
class OverviewController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
protected Database $influx;
|
||||
|
||||
public function __construct(EntityManager $em, Entity\Repository\SettingsRepository $settingsRepo, Database $influx)
|
||||
{
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Database $influx
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->settingsRepo = $settingsRepo;
|
||||
$this->influx = $influx;
|
||||
|
|
|
@ -6,16 +6,16 @@ use App\Http\Response;
|
|||
use App\Http\ServerRequest;
|
||||
use App\Sync\Task\RadioAutomation;
|
||||
use App\Utilities\Csv;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class PerformanceController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected RadioAutomation $sync_automation;
|
||||
|
||||
public function __construct(EntityManager $em, RadioAutomation $sync_automation)
|
||||
public function __construct(EntityManagerInterface $em, RadioAutomation $sync_automation)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->sync_automation = $sync_automation;
|
||||
|
|
|
@ -5,16 +5,16 @@ use App\Entity;
|
|||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class RequestsController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected string $csrf_namespace = 'stations_requests';
|
||||
|
||||
public function __construct(EntityManager $em)
|
||||
public function __construct(EntityManagerInterface $em)
|
||||
{
|
||||
$this->em = $em;
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
namespace App\Controller\Stations\Reports;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Form\Form;
|
||||
use App\Http\Response;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
|
@ -15,21 +15,13 @@ use Psr\Http\Message\ResponseInterface;
|
|||
*/
|
||||
class SoundExchangeController
|
||||
{
|
||||
/** @var EntityManager */
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
/** @var Client */
|
||||
protected Client $http_client;
|
||||
|
||||
/** @var array */
|
||||
protected array $form_config;
|
||||
|
||||
/**
|
||||
* @param EntityManager $em
|
||||
* @param Client $http_client
|
||||
* @param Config $config
|
||||
*/
|
||||
public function __construct(EntityManager $em, Client $http_client, Config $config)
|
||||
public function __construct(EntityManagerInterface $em, Client $http_client, Config $config)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->form_config = $config->get('forms/report/soundexchange');
|
||||
|
|
|
@ -7,19 +7,19 @@ use App\Http\Response;
|
|||
use App\Http\ServerRequest;
|
||||
use App\Service\AzuraCastCentral;
|
||||
use App\Session\Flash;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class StreamersController
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected AzuraCastCentral $ac_central;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
AzuraCastCentral $ac_central,
|
||||
Entity\Repository\SettingsRepository $settingsRepo
|
||||
) {
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
namespace App\Doctrine;
|
||||
|
||||
use Closure;
|
||||
use Doctrine\ORM\Decorator\EntityManagerDecorator;
|
||||
|
||||
class DecoratedEntityManager extends EntityManagerDecorator
|
||||
{
|
||||
protected Closure $createEm;
|
||||
|
||||
public function __construct(callable $createEm)
|
||||
{
|
||||
parent::__construct($createEm());
|
||||
$this->createEm = Closure::fromCallable($createEm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Recreate the underlying EntityManager if it was closed due to a previous exception.
|
||||
*/
|
||||
public function open(): void
|
||||
{
|
||||
if (!$this->wrapped->isOpen()) {
|
||||
$this->wrapped = ($this->createEm)();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetch a new, managed instance of an entity object, even if the EntityManager has been cleared.
|
||||
*
|
||||
* @template T
|
||||
*
|
||||
* @param T $entity
|
||||
*
|
||||
* @return T
|
||||
*/
|
||||
public function refetch($entity)
|
||||
{
|
||||
$metadata = $this->wrapped->getClassMetadata(get_class($entity));
|
||||
$freshValue = $this->wrapped->find($metadata->getName(), $metadata->getIdentifierValues($entity));
|
||||
|
||||
if (!$freshValue) {
|
||||
throw new \InvalidArgumentException(
|
||||
sprintf('Object of class %s cannot be refetched.', get_class($entity))
|
||||
);
|
||||
}
|
||||
|
||||
return $freshValue;
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -7,7 +7,7 @@ use App\Annotations\AuditLog\AuditIgnore;
|
|||
use App\Entity;
|
||||
use Doctrine\Common\Annotations\Reader;
|
||||
use Doctrine\Common\EventSubscriber;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Event\OnFlushEventArgs;
|
||||
use Doctrine\ORM\Events;
|
||||
use Doctrine\ORM\Mapping\ClassMetadataInfo;
|
||||
|
@ -219,12 +219,12 @@ class AuditLog implements EventSubscriber
|
|||
}
|
||||
|
||||
/**
|
||||
* @param EntityManager $em
|
||||
* @param EntityManagerInterface $em
|
||||
* @param object|string $class
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isEntity(EntityManager $em, $class): bool
|
||||
protected function isEntity(EntityManagerInterface $em, $class): bool
|
||||
{
|
||||
if (is_object($class)) {
|
||||
$class = ($class instanceof Proxy || $class instanceof GhostObjectInterface)
|
||||
|
|
|
@ -5,6 +5,7 @@ use App\Normalizer\DoctrineEntityNormalizer;
|
|||
use App\Settings;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
|
@ -30,13 +31,17 @@ class Repository
|
|||
protected $logger;
|
||||
|
||||
/**
|
||||
* @param EntityManager $em
|
||||
* @param EntityManagerInterface $em
|
||||
* @param Serializer $serializer
|
||||
* @param Settings $settings
|
||||
* @param LoggerInterface $logger
|
||||
*/
|
||||
public function __construct(EntityManager $em, Serializer $serializer, Settings $settings, LoggerInterface $logger)
|
||||
{
|
||||
public function __construct(
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
Settings $settings,
|
||||
LoggerInterface $logger
|
||||
) {
|
||||
$this->em = $em;
|
||||
$this->serializer = $serializer;
|
||||
$this->settings = $settings;
|
||||
|
|
|
@ -5,7 +5,7 @@ use App\ApiUtilities;
|
|||
use App\Doctrine\Repository;
|
||||
use App\Entity;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\QueryBuilder;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
@ -16,7 +16,7 @@ class SongHistoryRepository extends Repository
|
|||
protected ListenerRepository $listenerRepository;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
Settings $settings,
|
||||
LoggerInterface $logger,
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\Exception\MediaProcessingException;
|
|||
use App\Flysystem\Filesystem;
|
||||
use App\Service\AudioWaveform;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Exception;
|
||||
use getID3;
|
||||
|
@ -27,7 +27,7 @@ class StationMediaRepository extends Repository
|
|||
protected CustomFieldRepository $customFieldRepo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
Settings $settings,
|
||||
LoggerInterface $logger,
|
||||
|
|
|
@ -9,7 +9,7 @@ use App\Radio\Frontend\AbstractFrontend;
|
|||
use App\Sync\Task\Media;
|
||||
use App\Utilities;
|
||||
use Closure;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Exception;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Psr\SimpleCache\CacheInterface;
|
||||
|
@ -29,7 +29,7 @@ class StationRepository extends Repository
|
|||
protected CacheInterface $cache;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
\App\Settings $settings,
|
||||
LoggerInterface $logger,
|
||||
|
|
|
@ -5,17 +5,18 @@ use App\Entity;
|
|||
use App\Http\ServerRequest;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
abstract class AbstractSettingsForm extends Form
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
protected Settings $settings;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Settings $settings,
|
||||
array $formConfig
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class ApiKeyForm extends EntityForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Settings;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class BackupSettingsForm extends AbstractSettingsForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Settings $settings,
|
||||
Config $config
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Settings;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class BrandingSettingsForm extends AbstractSettingsForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Settings $settings,
|
||||
Config $config
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class CustomFieldForm extends EntityForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config
|
||||
) {
|
||||
$form_config = $config->get('forms/custom_field');
|
||||
parent::__construct($em, $serializer, $validator, $form_config);
|
||||
|
||||
|
||||
$this->entityClass = Entity\CustomField::class;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@ use App\Exception;
|
|||
use App\Http\ServerRequest;
|
||||
use App\Normalizer\DoctrineEntityNormalizer;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityRepository;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\Persistence\ObjectRepository;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
|
@ -23,7 +23,7 @@ use Symfony\Component\Validator\Validator\ValidatorInterface;
|
|||
*/
|
||||
class EntityForm extends Form
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Serializer $serializer;
|
||||
|
||||
|
@ -38,7 +38,7 @@ class EntityForm extends Form
|
|||
protected ?Station $station = null;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
array $options = [],
|
||||
|
@ -61,12 +61,12 @@ class EntityForm extends Form
|
|||
$this->entityClass = $entityClass;
|
||||
}
|
||||
|
||||
public function getEntityManager(): EntityManager
|
||||
public function getEntityManager(): EntityManagerInterface
|
||||
{
|
||||
return $this->em;
|
||||
}
|
||||
|
||||
public function getEntityRepository(): EntityRepository
|
||||
public function getEntityRepository(): ObjectRepository
|
||||
{
|
||||
if (null === $this->entityClass) {
|
||||
throw new Exception('Entity class name is not specified.');
|
||||
|
|
|
@ -5,14 +5,14 @@ use App\Config;
|
|||
use App\Entity;
|
||||
use App\Settings;
|
||||
use App\Sync\Task\UpdateGeoLiteDatabase;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class GeoLiteSettingsForm extends AbstractSettingsForm
|
||||
{
|
||||
protected UpdateGeoLiteDatabase $syncTask;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Settings $settings,
|
||||
Config $config,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
@ -15,7 +15,7 @@ class PermissionsForm extends EntityForm
|
|||
protected bool $set_permissions = true;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config,
|
||||
|
@ -61,7 +61,7 @@ class PermissionsForm extends EntityForm
|
|||
|
||||
return $record;
|
||||
}
|
||||
|
||||
|
||||
protected function _normalizeRecord($record, array $context = []): array
|
||||
{
|
||||
$data = parent::_normalizeRecord($record, $context);
|
||||
|
|
|
@ -5,12 +5,12 @@ use App\Config;
|
|||
use App\Entity;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
|
||||
class SettingsForm extends AbstractSettingsForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Settings $settings,
|
||||
Config $config
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class SftpUserForm extends EntityForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Settings;
|
|||
use App\Sync\Task\Media;
|
||||
use DeepCopy;
|
||||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
|
@ -23,7 +23,7 @@ class StationCloneForm extends StationForm
|
|||
protected Media $media_sync;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Entity\Repository\StationRepository $station_repo,
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\Entity;
|
|||
use App\Http\ServerRequest;
|
||||
use App\Radio\Frontend\SHOUTcast;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\ConstraintViolation;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
@ -21,7 +21,7 @@ class StationForm extends EntityForm
|
|||
protected Settings $settings;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Entity\Repository\StationRepository $station_repo,
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Entity\Station;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Radio\Adapters;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
|
@ -15,7 +15,7 @@ class StationMountForm extends EntityForm
|
|||
protected array $form_configs;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Entity;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class StationRemoteForm extends EntityForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Entity;
|
|||
use App\Http\Router;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use InvalidArgumentException;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
@ -18,7 +18,7 @@ class StationWebhookForm extends EntityForm
|
|||
protected array $forms;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Settings $settings,
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
namespace App\Form;
|
||||
|
||||
use App\Config;
|
||||
use App\Entity;
|
||||
use App\Http\ServerRequest;
|
||||
use App\Config;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class UserForm extends EntityForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config,
|
||||
|
|
|
@ -6,14 +6,14 @@ use App\Entity;
|
|||
use App\Http\ServerRequest;
|
||||
use App\Settings;
|
||||
use AzuraForms\Field\AbstractField;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\Serializer\Serializer;
|
||||
use Symfony\Component\Validator\Validator\ValidatorInterface;
|
||||
|
||||
class UserProfileForm extends EntityForm
|
||||
{
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Serializer $serializer,
|
||||
ValidatorInterface $validator,
|
||||
Config $config,
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Http;
|
|||
use App\Flysystem\FilesystemGroup;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
|
||||
class Response extends \Slim\Http\Response
|
||||
final class Response extends \Slim\Http\Response
|
||||
{
|
||||
public const CACHE_ONE_MINUTE = 60;
|
||||
public const CACHE_ONE_HOUR = 3600;
|
||||
|
|
|
@ -10,7 +10,7 @@ use App\Session;
|
|||
use App\View;
|
||||
use Mezzio\Session\SessionInterface;
|
||||
|
||||
class ServerRequest extends \Slim\Http\ServerRequest
|
||||
final class ServerRequest extends \Slim\Http\ServerRequest
|
||||
{
|
||||
public const ATTR_VIEW = 'app_view';
|
||||
public const ATTR_SESSION = 'app_session';
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
namespace App;
|
||||
|
||||
use App\Doctrine\DecoratedEntityManager;
|
||||
use App\Message\AbstractDelayedMessage;
|
||||
use Bernard\BernardEvents;
|
||||
use Bernard\Consumer;
|
||||
|
@ -10,7 +11,6 @@ use Bernard\Message;
|
|||
use Bernard\Producer;
|
||||
use Bernard\Queue;
|
||||
use Bernard\QueueFactory;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Monolog\Logger;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
|
@ -26,14 +26,14 @@ class MessageQueue implements EventSubscriberInterface
|
|||
|
||||
protected Logger $logger;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected DecoratedEntityManager $em;
|
||||
|
||||
public function __construct(
|
||||
QueueFactory $queues,
|
||||
Producer $producer,
|
||||
Consumer $consumer,
|
||||
Logger $logger,
|
||||
EntityManager $em
|
||||
DecoratedEntityManager $em
|
||||
) {
|
||||
$this->queues = $queues;
|
||||
$this->producer = $producer;
|
||||
|
@ -120,12 +120,7 @@ class MessageQueue implements EventSubscriberInterface
|
|||
|
||||
public function checkEntityManager(): void
|
||||
{
|
||||
// Shut the process manager down if the entity manager isn't open.
|
||||
if (!$this->em->isOpen()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
// Clear the EM before running any new tasks.
|
||||
$this->em->open();
|
||||
$this->em->clear();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Middleware;
|
||||
|
||||
use App\Doctrine\DecoratedEntityManager;
|
||||
use App\Settings;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Psr\Http\Server\MiddlewareInterface;
|
||||
use Psr\Http\Server\RequestHandlerInterface;
|
||||
|
||||
class ReopenEntityManagerMiddleware implements MiddlewareInterface
|
||||
{
|
||||
protected DecoratedEntityManager $em;
|
||||
|
||||
protected Settings $settings;
|
||||
|
||||
public function __construct(DecoratedEntityManager $em, Settings $settings)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
$this->em->open();
|
||||
|
||||
try {
|
||||
return $handler->handle($request);
|
||||
} finally {
|
||||
if (!$this->settings->isTesting()) {
|
||||
$this->em->getConnection()->close();
|
||||
}
|
||||
|
||||
$this->em->clear();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ use Doctrine\Common\Annotations\Reader;
|
|||
use Doctrine\Common\Collections\Collection;
|
||||
use Doctrine\Inflector\Inflector;
|
||||
use Doctrine\Inflector\InflectorFactory;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
|
||||
use Doctrine\ORM\Proxy\Proxy;
|
||||
use InvalidArgumentException;
|
||||
|
@ -40,21 +40,14 @@ class DoctrineEntityNormalizer extends AbstractNormalizer
|
|||
/** @var SerializerInterface|NormalizerInterface|DenormalizerInterface */
|
||||
protected $serializer;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Reader $annotationReader;
|
||||
|
||||
protected Inflector $inflector;
|
||||
|
||||
/**
|
||||
* @param EntityManager $em
|
||||
* @param Reader|null $annotationReader
|
||||
* @param ClassMetadataFactoryInterface|null $classMetadataFactory
|
||||
* @param NameConverterInterface|null $nameConverter
|
||||
* @param array $defaultContext
|
||||
*/
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Reader $annotationReader = null,
|
||||
ClassMetadataFactoryInterface $classMetadataFactory = null,
|
||||
NameConverterInterface $nameConverter = null,
|
||||
|
@ -397,7 +390,9 @@ class DoctrineEntityNormalizer extends AbstractNormalizer
|
|||
$first_param = $method->getParameters()[0];
|
||||
|
||||
if ($first_param->hasType()) {
|
||||
$first_param_type = $first_param->getType()->getName();
|
||||
/** @var \ReflectionNamedType $firstParamTypeObj */
|
||||
$firstParamTypeObj = $first_param->getType();
|
||||
$first_param_type = $firstParamTypeObj->getName();
|
||||
|
||||
switch ($first_param_type) {
|
||||
case 'DateTime':
|
||||
|
|
|
@ -6,7 +6,7 @@ use App\Entity;
|
|||
use App\Event\GetNotifications;
|
||||
use App\Settings;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Monolog\Logger;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
|
@ -14,7 +14,7 @@ class Manager implements EventSubscriberInterface
|
|||
{
|
||||
protected Acl $acl;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Logger $logger;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Manager implements EventSubscriberInterface
|
|||
|
||||
public function __construct(
|
||||
Acl $acl,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settings_repo,
|
||||
Logger $logger,
|
||||
Settings $app_settings
|
||||
|
|
|
@ -2,28 +2,28 @@
|
|||
namespace App\Radio;
|
||||
|
||||
use App\Entity;
|
||||
use App\EventDispatcher;
|
||||
use App\Exception\Supervisor\AlreadyRunningException;
|
||||
use App\Exception\Supervisor\BadNameException;
|
||||
use App\Exception\Supervisor\NotRunningException;
|
||||
use App\Exception\SupervisorException;
|
||||
use App\Settings;
|
||||
use App\EventDispatcher;
|
||||
use App\Logger;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use fXmlRpc\Exception\FaultException;
|
||||
use Supervisor\Process;
|
||||
use Supervisor\Supervisor;
|
||||
|
||||
abstract class AbstractAdapter
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Supervisor $supervisor;
|
||||
|
||||
protected EventDispatcher $dispatcher;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Supervisor $supervisor,
|
||||
EventDispatcher $dispatcher
|
||||
) {
|
||||
|
|
|
@ -9,7 +9,7 @@ use App\Flysystem\Filesystem;
|
|||
use App\Lock\LockManager;
|
||||
use Cake\Chronos\Chronos;
|
||||
use DateTimeZone;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Monolog\Logger;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
|
@ -17,7 +17,7 @@ class AutoDJ implements EventSubscriberInterface
|
|||
{
|
||||
protected Adapters $adapters;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SongRepository $songRepo;
|
||||
|
||||
|
@ -39,7 +39,7 @@ class AutoDJ implements EventSubscriberInterface
|
|||
|
||||
public function __construct(
|
||||
Adapters $adapters,
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SongRepository $songRepo,
|
||||
Entity\Repository\SongHistoryRepository $songHistoryRepo,
|
||||
Entity\Repository\StationPlaylistMediaRepository $spmRepo,
|
||||
|
|
|
@ -7,7 +7,7 @@ use App\EventDispatcher;
|
|||
use App\Exception;
|
||||
use App\Radio\Backend\Liquidsoap\ConfigWriter;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Http\Message\UriInterface;
|
||||
use Supervisor\Supervisor;
|
||||
|
||||
|
@ -16,7 +16,7 @@ class Liquidsoap extends AbstractBackend
|
|||
protected Entity\Repository\StationStreamerRepository $streamerRepo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Supervisor $supervisor,
|
||||
EventDispatcher $dispatcher,
|
||||
Entity\Repository\StationStreamerRepository $streamerRepo
|
||||
|
|
|
@ -9,7 +9,7 @@ use App\Message;
|
|||
use App\Radio\Adapters;
|
||||
use App\Radio\Backend\Liquidsoap;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
||||
|
||||
class ConfigWriter implements EventSubscriberInterface
|
||||
|
@ -24,11 +24,11 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
public const CROSSFADE_DISABLED = 'none';
|
||||
public const CROSSFADE_SMART = 'smart';
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Liquidsoap $liquidsoap;
|
||||
|
||||
public function __construct(EntityManager $em, Liquidsoap $liquidsoap)
|
||||
public function __construct(EntityManagerInterface $em, Liquidsoap $liquidsoap)
|
||||
{
|
||||
$this->em = $em;
|
||||
$this->liquidsoap = $liquidsoap;
|
||||
|
@ -175,8 +175,7 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
// Auto-create an empty default playlist.
|
||||
$defaultPlaylist = new Entity\StationPlaylist($station);
|
||||
$defaultPlaylist->setName('default');
|
||||
|
||||
/** @var EntityManager $em */
|
||||
|
||||
$this->em->persist($defaultPlaylist);
|
||||
$this->em->flush();
|
||||
|
||||
|
@ -482,7 +481,7 @@ class ConfigWriter implements EventSubscriberInterface
|
|||
|
||||
$mediaBaseDir = $station->getRadioMediaDir() . '/';
|
||||
$playlistFile = [];
|
||||
|
||||
|
||||
$mediaQuery = $this->em->createQuery(/** @lang DQL */ 'SELECT DISTINCT sm
|
||||
FROM App\Entity\StationMedia sm
|
||||
JOIN sm.playlists spm
|
||||
|
|
|
@ -4,7 +4,7 @@ namespace App\Radio;
|
|||
use App\Entity\Station;
|
||||
use App\Exception;
|
||||
use App\Settings;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use fXmlRpc\Exception\FaultException;
|
||||
use Monolog\Logger;
|
||||
use RuntimeException;
|
||||
|
@ -15,7 +15,7 @@ class Configuration
|
|||
public const DEFAULT_PORT_MIN = 8000;
|
||||
public const DEFAULT_PORT_MAX = 8499;
|
||||
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Adapters $adapters;
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Configuration
|
|||
protected Logger $logger;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Adapters $adapters,
|
||||
Supervisor $supervisor,
|
||||
Logger $logger
|
||||
|
|
|
@ -8,7 +8,7 @@ use App\Logger;
|
|||
use App\Radio\AbstractAdapter;
|
||||
use App\Settings;
|
||||
use App\Xml\Reader;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use NowPlaying\Adapter\AdapterAbstract;
|
||||
|
@ -28,7 +28,7 @@ abstract class AbstractFrontend extends AbstractAdapter
|
|||
protected Entity\Repository\StationMountRepository $stationMountRepo;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Entity\Repository\StationMountRepository $stationMountRepo,
|
||||
Supervisor $supervisor,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace App\Radio\Remote;
|
||||
|
||||
use App\Entity;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Uri;
|
||||
use Monolog\Logger;
|
||||
|
@ -10,7 +10,7 @@ use NowPlaying\Adapter\AdapterAbstract;
|
|||
|
||||
abstract class AbstractRemote
|
||||
{
|
||||
protected EntityManager $em;
|
||||
protected EntityManagerInterface $em;
|
||||
|
||||
protected Entity\Repository\SettingsRepository $settingsRepo;
|
||||
|
||||
|
@ -19,7 +19,7 @@ abstract class AbstractRemote
|
|||
protected Logger $logger;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $em,
|
||||
EntityManagerInterface $em,
|
||||
Entity\Repository\SettingsRepository $settingsRepo,
|
||||
Client $http_client,
|
||||
Logger $logger
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue