From 9ab4f6cf5704f5e41c72d1f5d652ec1013f393c1 Mon Sep 17 00:00:00 2001 From: Brock H Caldwell Date: Tue, 10 Jun 2025 15:10:00 -0500 Subject: [PATCH] fix: adds timestamps to download entity --- composer.json | 1 + composer.lock | 263 +++++++++++++++++- config/bundles.php | 1 + config/packages/stof_doctrine_extensions.yaml | 7 + migrations/Version20250610195448.php | 35 +++ src/Download/Framework/Entity/Download.php | 5 +- symfony.lock | 12 + 7 files changed, 321 insertions(+), 3 deletions(-) create mode 100644 config/packages/stof_doctrine_extensions.yaml create mode 100644 migrations/Version20250610195448.php diff --git a/composer.json b/composer.json index d2f900b..8b284c3 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "php-tmdb/api": "^4.1", "predis/predis": "^2.4", "runtime/frankenphp-symfony": "^0.2.0", + "stof/doctrine-extensions-bundle": "^1.14", "symfony/asset": "7.3.*", "symfony/console": "7.3.*", "symfony/doctrine-messenger": "7.3.*", diff --git a/composer.lock b/composer.lock index 8b559ec..0f0d50c 100644 --- a/composer.lock +++ b/composer.lock @@ -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": "c519733202d45f8fb3a4f5b8e7dfb95b", + "content-hash": "55c76ae7fe5ad6e5c7edbb0150987fc7", "packages": [ { "name": "1tomany/rich-bundle", @@ -117,6 +117,56 @@ }, "time": "2025-03-05T09:16:18+00:00" }, + { + "name": "behat/transliterator", + "version": "v1.5.0", + "source": { + "type": "git", + "url": "https://github.com/Behat/Transliterator.git", + "reference": "baac5873bac3749887d28ab68e2f74db3a4408af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Behat/Transliterator/zipball/baac5873bac3749887d28ab68e2f74db3a4408af", + "reference": "baac5873bac3749887d28ab68e2f74db3a4408af", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "require-dev": { + "chuyskywalker/rolling-curl": "^3.1", + "php-yaoi/php-yaoi": "^1.0", + "phpunit/phpunit": "^8.5.25 || ^9.5.19" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Behat\\Transliterator\\": "src/Behat/Transliterator" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Artistic-1.0" + ], + "description": "String transliterator", + "keywords": [ + "i18n", + "slug", + "transliterator" + ], + "support": { + "issues": "https://github.com/Behat/Transliterator/issues", + "source": "https://github.com/Behat/Transliterator/tree/v1.5.0" + }, + "abandoned": true, + "time": "2022-03-30T09:27:43+00:00" + }, { "name": "carbonphp/carbon-doctrine-types", "version": "2.1.0", @@ -1768,6 +1818,136 @@ ], "time": "2024-10-09T13:47:03+00:00" }, + { + "name": "gedmo/doctrine-extensions", + "version": "v3.20.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine-extensions/DoctrineExtensions.git", + "reference": "ea1d37586b8e4bae2a815feb38b177894b12c44c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine-extensions/DoctrineExtensions/zipball/ea1d37586b8e4bae2a815feb38b177894b12c44c", + "reference": "ea1d37586b8e4bae2a815feb38b177894b12c44c", + "shasum": "" + }, + "require": { + "behat/transliterator": "^1.2", + "doctrine/collections": "^1.2 || ^2.0", + "doctrine/deprecations": "^1.0", + "doctrine/event-manager": "^1.2 || ^2.0", + "doctrine/persistence": "^2.2 || ^3.0 || ^4.0", + "php": "^7.4 || ^8.0", + "psr/cache": "^1 || ^2 || ^3", + "psr/clock": "^1", + "symfony/cache": "^5.4 || ^6.0 || ^7.0" + }, + "conflict": { + "doctrine/annotations": "<1.13 || >=3.0", + "doctrine/common": "<2.13 || >=4.0", + "doctrine/dbal": "<3.7 || >=5.0", + "doctrine/mongodb-odm": "<2.3 || >=3.0", + "doctrine/orm": "<2.20 || >=3.0 <3.3 || >=4.0" + }, + "require-dev": { + "doctrine/annotations": "^1.13 || ^2.0", + "doctrine/cache": "^1.11 || ^2.0", + "doctrine/common": "^2.13 || ^3.0", + "doctrine/dbal": "^3.7 || ^4.0", + "doctrine/doctrine-bundle": "^2.3", + "doctrine/mongodb-odm": "^2.3", + "doctrine/orm": "^2.20 || ^3.3", + "friendsofphp/php-cs-fixer": "^3.70", + "nesbot/carbon": "^2.71 || ^3.0", + "phpstan/phpstan": "^2.1.1", + "phpstan/phpstan-doctrine": "^2.0.1", + "phpstan/phpstan-phpunit": "^2.0.3", + "phpunit/phpunit": "^9.6", + "rector/rector": "^2.0.6", + "symfony/console": "^5.4 || ^6.0 || ^7.0", + "symfony/doctrine-bridge": "^5.4 || ^6.0 || ^7.0", + "symfony/phpunit-bridge": "^6.0 || ^7.0", + "symfony/uid": "^5.4 || ^6.0 || ^7.0", + "symfony/yaml": "^5.4 || ^6.0 || ^7.0" + }, + "suggest": { + "doctrine/mongodb-odm": "to use the extensions with the MongoDB ODM", + "doctrine/orm": "to use the extensions with the ORM" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Gedmo\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gediminas Morkevicius", + "email": "gediminas.morkevicius@gmail.com" + }, + { + "name": "Gustavo Falco", + "email": "comfortablynumb84@gmail.com" + }, + { + "name": "David Buchmann", + "email": "david@liip.ch" + } + ], + "description": "Doctrine behavioral extensions", + "homepage": "http://gediminasm.org/", + "keywords": [ + "Blameable", + "behaviors", + "doctrine", + "extensions", + "gedmo", + "loggable", + "nestedset", + "odm", + "orm", + "sluggable", + "sortable", + "timestampable", + "translatable", + "tree", + "uploadable" + ], + "support": { + "docs": "https://github.com/doctrine-extensions/DoctrineExtensions/tree/main/doc", + "issues": "https://github.com/doctrine-extensions/DoctrineExtensions/issues", + "source": "https://github.com/doctrine-extensions/DoctrineExtensions/tree/v3.20.0" + }, + "funding": [ + { + "url": "https://github.com/l3pp4rd", + "type": "github" + }, + { + "url": "https://github.com/mbabker", + "type": "github" + }, + { + "url": "https://github.com/phansys", + "type": "github" + }, + { + "url": "https://github.com/stof", + "type": "github" + } + ], + "time": "2025-04-04T17:19:27+00:00" + }, { "name": "lcobucci/jwt", "version": "5.5.0", @@ -3401,6 +3581,87 @@ ], "time": "2023-12-12T12:06:11+00:00" }, + { + "name": "stof/doctrine-extensions-bundle", + "version": "v1.14.0", + "source": { + "type": "git", + "url": "https://github.com/stof/StofDoctrineExtensionsBundle.git", + "reference": "bdf3eb10baeb497ac5985b8f78a6cf55862c2662" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/stof/StofDoctrineExtensionsBundle/zipball/bdf3eb10baeb497ac5985b8f78a6cf55862c2662", + "reference": "bdf3eb10baeb497ac5985b8f78a6cf55862c2662", + "shasum": "" + }, + "require": { + "gedmo/doctrine-extensions": "^3.20.0", + "php": "^8.1", + "symfony/cache": "^6.4 || ^7.0", + "symfony/config": "^6.4 || ^7.0", + "symfony/dependency-injection": "^6.4 || ^7.0", + "symfony/event-dispatcher": "^6.4 || ^7.0", + "symfony/http-kernel": "^6.4 || ^7.0", + "symfony/translation-contracts": "^2.5 || ^3.5" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpstan/phpstan-symfony": "^2.0", + "symfony/mime": "^6.4 || ^7.0", + "symfony/phpunit-bridge": "^v6.4.1 || ^7.0.1", + "symfony/security-core": "^6.4 || ^7.0" + }, + "suggest": { + "doctrine/doctrine-bundle": "to use the ORM extensions", + "doctrine/mongodb-odm-bundle": "to use the MongoDB ODM extensions", + "symfony/mime": "To use the Mime component integration for Uploadable" + }, + "type": "symfony-bundle", + "extra": { + "branch-alias": { + "dev-main": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Stof\\DoctrineExtensionsBundle\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christophe Coevoet", + "email": "stof@notk.org" + } + ], + "description": "Integration of the gedmo/doctrine-extensions with Symfony", + "homepage": "https://github.com/stof/StofDoctrineExtensionsBundle", + "keywords": [ + "behaviors", + "doctrine2", + "extensions", + "gedmo", + "loggable", + "nestedset", + "sluggable", + "sortable", + "timestampable", + "translatable", + "tree" + ], + "support": { + "issues": "https://github.com/stof/StofDoctrineExtensionsBundle/issues", + "source": "https://github.com/stof/StofDoctrineExtensionsBundle/tree/v1.14.0" + }, + "time": "2025-05-01T08:00:32+00:00" + }, { "name": "symfony/asset", "version": "v7.3.0", diff --git a/config/bundles.php b/config/bundles.php index 6ef85e3..c501bd2 100644 --- a/config/bundles.php +++ b/config/bundles.php @@ -18,4 +18,5 @@ return [ Symfony\UX\Turbo\TurboBundle::class => ['all' => true], Symfony\Bundle\WebProfilerBundle\WebProfilerBundle::class => ['dev' => true, 'test' => true], Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true], + Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true], ]; diff --git a/config/packages/stof_doctrine_extensions.yaml b/config/packages/stof_doctrine_extensions.yaml new file mode 100644 index 0000000..cf0d40f --- /dev/null +++ b/config/packages/stof_doctrine_extensions.yaml @@ -0,0 +1,7 @@ +# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html +# See the official DoctrineExtensions documentation for more details: https://github.com/doctrine-extensions/DoctrineExtensions/tree/main/doc +stof_doctrine_extensions: + default_locale: en_US + orm: + default: + timestampable: true diff --git a/migrations/Version20250610195448.php b/migrations/Version20250610195448.php new file mode 100644 index 0000000..73ceba7 --- /dev/null +++ b/migrations/Version20250610195448.php @@ -0,0 +1,35 @@ +addSql(<<<'SQL' + ALTER TABLE download ADD created_at DATETIME NULL, ADD updated_at DATETIME NULL + SQL); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql(<<<'SQL' + ALTER TABLE download DROP created_at, DROP updated_at + SQL); + } +} diff --git a/src/Download/Framework/Entity/Download.php b/src/Download/Framework/Entity/Download.php index 7c80dbc..67add3a 100644 --- a/src/Download/Framework/Entity/Download.php +++ b/src/Download/Framework/Entity/Download.php @@ -3,10 +3,9 @@ namespace App\Download\Framework\Entity; use App\Download\Framework\Repository\DownloadRepository; -use App\Torrentio\Result\ResultFactory; -use App\Torrentio\Result\TorrentioResult; use App\User\Framework\Entity\User; use Doctrine\ORM\Mapping as ORM; +use Gedmo\Timestampable\Traits\TimestampableEntity; use Nihilarr\PTN; use Symfony\UX\Turbo\Attribute\Broadcast; @@ -14,6 +13,8 @@ use Symfony\UX\Turbo\Attribute\Broadcast; #[Broadcast(template: 'broadcast/Download.stream.html.twig')] class Download { + use TimestampableEntity; + #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] diff --git a/symfony.lock b/symfony.lock index 609ce35..e8e21b9 100644 --- a/symfony.lock +++ b/symfony.lock @@ -74,6 +74,18 @@ "phpstan.dist.neon" ] }, + "stof/doctrine-extensions-bundle": { + "version": "1.14", + "recipe": { + "repo": "github.com/symfony/recipes-contrib", + "branch": "main", + "version": "1.2", + "ref": "e805aba9eff5372e2d149a9ff56566769e22819d" + }, + "files": [ + "config/packages/stof_doctrine_extensions.yaml" + ] + }, "symfony/asset-mapper": { "version": "7.2", "recipe": {