From b8555575940c1cfd790c7add21f4c5cea91a2390 Mon Sep 17 00:00:00 2001 From: Manuel Aranda Date: Fri, 9 Aug 2024 08:18:51 +0200 Subject: [PATCH] refs #632. Create table ogLive --- config/api_platform/OgLive.yaml | 0 migrations/Version20240808140716.php | 31 ++++++++++++++ src/Dto/Input/OgLiveInput.php | 8 ++++ src/Dto/Output/OgLiveOutput.php | 8 ++++ src/Entity/OgLive.php | 30 +++++++++++++ src/Factory/OgLiveFactory.php | 56 +++++++++++++++++++++++++ src/Repository/OgLiveRepository.php | 18 ++++++++ src/State/Processor/OgLiveProcessor.php | 8 ++++ src/State/Provider/OgLiveProvider.php | 8 ++++ tests/Functional/OgLiveTest.php | 8 ++++ 10 files changed, 175 insertions(+) create mode 100644 config/api_platform/OgLive.yaml create mode 100644 migrations/Version20240808140716.php create mode 100644 src/Dto/Input/OgLiveInput.php create mode 100644 src/Dto/Output/OgLiveOutput.php create mode 100644 src/Entity/OgLive.php create mode 100644 src/Factory/OgLiveFactory.php create mode 100644 src/Repository/OgLiveRepository.php create mode 100644 src/State/Processor/OgLiveProcessor.php create mode 100644 src/State/Provider/OgLiveProvider.php create mode 100644 tests/Functional/OgLiveTest.php diff --git a/config/api_platform/OgLive.yaml b/config/api_platform/OgLive.yaml new file mode 100644 index 0000000..e69de29 diff --git a/migrations/Version20240808140716.php b/migrations/Version20240808140716.php new file mode 100644 index 0000000..b61c4df --- /dev/null +++ b/migrations/Version20240808140716.php @@ -0,0 +1,31 @@ +addSql('CREATE TABLE og_live (id INT AUTO_INCREMENT NOT NULL, uuid CHAR(36) NOT NULL COMMENT \'(DC2Type:uuid)\', migration_id VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, created_by VARCHAR(255) DEFAULT NULL, updated_by VARCHAR(255) DEFAULT NULL, download_url VARCHAR(255) DEFAULT NULL, name VARCHAR(255) NOT NULL, UNIQUE INDEX UNIQ_3D6B7739D17F50A6 (uuid), UNIQUE INDEX UNIQ_IDENTIFIER_NAME (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('DROP TABLE og_live'); + } +} diff --git a/src/Dto/Input/OgLiveInput.php b/src/Dto/Input/OgLiveInput.php new file mode 100644 index 0000000..4f8d788 --- /dev/null +++ b/src/Dto/Input/OgLiveInput.php @@ -0,0 +1,8 @@ +downloadUrl; + } + + public function setDownloadUrl(?string $downloadUrl): static + { + $this->downloadUrl = $downloadUrl; + + return $this; + } +} diff --git a/src/Factory/OgLiveFactory.php b/src/Factory/OgLiveFactory.php new file mode 100644 index 0000000..cb90dcd --- /dev/null +++ b/src/Factory/OgLiveFactory.php @@ -0,0 +1,56 @@ + + */ +final class OgLiveFactory extends ModelFactory +{ + /** + * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#factories-as-services + * + * @todo inject services if required + */ + public function __construct() + { + parent::__construct(); + } + + /** + * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#model-factories + * + * @todo add your default values here + */ + protected function getDefaults(): array + { + return [ + 'createdAt' => self::faker()->dateTime(), + 'name' => self::faker()->text(255), + 'downloadUrl' => self::faker()->text(255), + 'updatedAt' => self::faker()->dateTime(), + ]; + } + + /** + * @see https://symfony.com/bundles/ZenstruckFoundryBundle/current/index.html#initialization + */ + protected function initialize(): self + { + return $this + // ->afterInstantiate(function(OgLive $ogLive): void {}) + ; + } + + protected static function getClass(): string + { + return OgLive::class; + } +} diff --git a/src/Repository/OgLiveRepository.php b/src/Repository/OgLiveRepository.php new file mode 100644 index 0000000..63e83cc --- /dev/null +++ b/src/Repository/OgLiveRepository.php @@ -0,0 +1,18 @@ + + */ +class OgLiveRepository extends AbstractRepository +{ + public function __construct(ManagerRegistry $registry) + { + parent::__construct($registry, OgLive::class); + } +} diff --git a/src/State/Processor/OgLiveProcessor.php b/src/State/Processor/OgLiveProcessor.php new file mode 100644 index 0000000..dff06bf --- /dev/null +++ b/src/State/Processor/OgLiveProcessor.php @@ -0,0 +1,8 @@ +