diff --git a/config/packages/doctrine.yaml b/config/packages/doctrine.yaml index 39536b6..ff0abee 100644 --- a/config/packages/doctrine.yaml +++ b/config/packages/doctrine.yaml @@ -7,17 +7,36 @@ parameters: doctrine: dbal: - # configure these for your database server - driver: 'pdo_sqlite' - url: '%env(resolve:DATABASE_URL)%' + default_connection: default + connections: + default: + driver: 'pdo_pgsql' + url: '%env(resolve:APP_DATABASE_URL)%' + magneticod: + driver: 'pdo_sqlite' + url: '%env(resolve:MAGNETICOD_DATABASE_URL)%' orm: auto_generate_proxy_classes: '%kernel.debug%' - naming_strategy: doctrine.orm.naming_strategy.underscore - auto_mapping: true - mappings: - App: - is_bundle: false - type: annotation - dir: '%kernel.project_dir%/src/Entity' - prefix: 'App\Entity' - alias: App + default_entity_manager: default + entity_managers: + default: + connection: default + naming_strategy: doctrine.orm.naming_strategy.underscore + auto_mapping: true + mappings: + App: + is_bundle: false + type: annotation + dir: '%kernel.project_dir%/src/Entity' + prefix: 'App\Entity' + alias: App + magneticod: + connection: magneticod + mappings: + Magnetico: + is_bundle: false + type: annotation + dir: '%kernel.project_dir%/src/Magnetico/Entity' + prefix: 'App\Magnetico' + alias: Magnetico + diff --git a/src/Api/V1/Controller/TorrentController.php b/src/Api/V1/Controller/TorrentController.php index a255c98..868f690 100644 --- a/src/Api/V1/Controller/TorrentController.php +++ b/src/Api/V1/Controller/TorrentController.php @@ -4,8 +4,8 @@ namespace App\Api\V1\Controller; use App\Api\V1\DTO\ApiResponse; use App\Api\V1\DTO\ListPage; -use App\Entity\Torrent; -use App\Repository\TorrentRepository; +use App\Magnetico\Entity\Torrent; +use App\Magnetico\Repository\TorrentRepository; use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Pagerfanta; use Symfony\Bundle\FrameworkBundle\Controller\Controller; diff --git a/src/Controller/MainController.php b/src/Controller/MainController.php index 1d22536..e2125a5 100644 --- a/src/Controller/MainController.php +++ b/src/Controller/MainController.php @@ -2,7 +2,7 @@ namespace App\Controller; -use App\Repository\TorrentRepository; +use App\Magnetico\Repository\TorrentRepository; use Symfony\Bundle\FrameworkBundle\Controller\Controller; use Symfony\Component\HttpFoundation\Response; diff --git a/src/Controller/TorrentController.php b/src/Controller/TorrentController.php index 737fbed..a6974bd 100644 --- a/src/Controller/TorrentController.php +++ b/src/Controller/TorrentController.php @@ -2,8 +2,8 @@ namespace App\Controller; -use App\Entity\Torrent; -use App\Repository\TorrentRepository; +use App\Magnetico\Entity\Torrent; +use App\Magnetico\Repository\TorrentRepository; use Pagerfanta\Adapter\DoctrineORMAdapter; use Pagerfanta\Pagerfanta; use Symfony\Bundle\FrameworkBundle\Controller\Controller; diff --git a/src/Entity/File.php b/src/Magnetico/Entity/File.php similarity index 91% rename from src/Entity/File.php rename to src/Magnetico/Entity/File.php index 5d04e27..e27477b 100644 --- a/src/Entity/File.php +++ b/src/Magnetico/Entity/File.php @@ -1,6 +1,6 @@ select('COUNT(t.id)') ; - return (int) $qb->getQuery()->getSingleScalarResult(); + try { + return (int) $qb->getQuery()->getSingleScalarResult(); + } catch (\Exception $ex) { + return 0; + } } public function createFindLikeQueryBuilder(string $query): QueryBuilder diff --git a/templates/torrent_list.html.twig b/templates/torrent_list.html.twig index 6973ec5..5133f93 100644 --- a/templates/torrent_list.html.twig +++ b/templates/torrent_list.html.twig @@ -13,7 +13,7 @@
Name | @@ -31,7 +31,7 @@
{{ file.path }} |