From bb965304bed3a29d79516db3d6dd06cd9481ac53 Mon Sep 17 00:00:00 2001 From: Arthur de Moulins Date: Mon, 25 Sep 2023 16:09:53 +0200 Subject: [PATCH] WIP --- databox/api/config/packages/fos_elastica.yaml | 15 +++++++-- .../Model/Output/Traits/CreatedAtDTOTrait.php | 6 ++-- .../Model/Output/Traits/UpdatedAtDTOTrait.php | 6 ++-- .../src/Attribute/Type/DateAttributeType.php | 12 ++----- .../Listener/SoftDeleteableInterface.php | 2 +- databox/api/src/Entity/AbstractUuidEntity.php | 4 ++- databox/api/src/Entity/Admin/ESIndexState.php | 5 +-- databox/api/src/Entity/Admin/PopulatePass.php | 19 ++++++------ databox/api/src/Entity/Basket/Basket.php | 1 + .../src/Entity/Core/AbstractBaseAttribute.php | 11 ++++--- databox/api/src/Entity/Core/AlternateUrl.php | 5 +-- databox/api/src/Entity/Core/Asset.php | 17 +++++----- .../api/src/Entity/Core/AssetFileVersion.php | 5 +-- .../api/src/Entity/Core/AssetRelationship.php | 5 +-- .../api/src/Entity/Core/AssetRendition.php | 1 + .../src/Entity/Core/AssetTitleAttribute.php | 5 +-- databox/api/src/Entity/Core/Attribute.php | 22 +++++++------ .../api/src/Entity/Core/AttributeClass.php | 9 +++--- .../src/Entity/Core/AttributeDefinition.php | 31 ++++++++++--------- databox/api/src/Entity/Core/Collection.php | 7 +++-- .../api/src/Entity/Core/CollectionAsset.php | 1 + databox/api/src/Entity/Core/File.php | 21 +++++++------ .../api/src/Entity/Core/RenditionClass.php | 5 +-- .../src/Entity/Core/RenditionDefinition.php | 19 ++++++------ databox/api/src/Entity/Core/RenditionRule.php | 10 +++--- databox/api/src/Entity/Core/Tag.php | 5 +-- databox/api/src/Entity/Core/TagFilterRule.php | 10 +++--- .../api/src/Entity/Core/UserPreference.php | 5 +-- databox/api/src/Entity/Core/Workspace.php | 15 ++++----- databox/api/src/Entity/FailedEvent.php | 6 ++-- .../Entity/Integration/IntegrationData.php | 7 +++-- .../src/Entity/Integration/WorkspaceEnv.php | 5 +-- .../Integration/WorkspaceIntegration.php | 11 ++++--- .../Entity/Integration/WorkspaceSecret.php | 5 +-- databox/api/src/Entity/Media/MediaIndex.php | 1 + .../src/Entity/Template/AssetDataTemplate.php | 15 ++++----- .../src/Entity/Template/TemplateAttribute.php | 6 ++-- .../api/src/Entity/Traits/CreatedAtTrait.php | 7 +++-- .../api/src/Entity/Traits/DeletedAtTrait.php | 9 +++--- databox/api/src/Entity/Traits/LocaleTrait.php | 3 +- .../api/src/Entity/Traits/UpdatedAtTrait.php | 7 +++-- .../Entity/Traits/WorkspacePrivacyTrait.php | 3 +- .../api/src/Entity/Traits/WorkspaceTrait.php | 1 + .../api/src/Entity/Workflow/WorkflowState.php | 3 +- expose/api/src/Entity/Asset.php | 31 ++++++++++--------- expose/api/src/Entity/DownloadRequest.php | 7 +++-- expose/api/src/Entity/EnvVar.php | 7 +++-- expose/api/src/Entity/FailedEvent.php | 3 +- expose/api/src/Entity/Publication.php | 15 ++++----- expose/api/src/Entity/PublicationConfig.php | 28 ++++++++--------- expose/api/src/Entity/PublicationProfile.php | 7 +++-- expose/api/src/Entity/SubDefinition.php | 11 ++++--- expose/api/src/Entity/TermsConfig.php | 5 +-- .../Entity/Traits/ClientAnnotationsTrait.php | 3 +- lib/js/react-ps/src/lib/oauth-client.ts | 15 ++++++++- .../core-bundle/Entity/AbstractUuidEntity.php | 4 ++- .../storage-bundle/Entity/MultipartUpload.php | 20 ++++++------ lib/php/webhook-bundle/Entity/Webhook.php | 22 +++++++------ lib/php/webhook-bundle/Entity/WebhookLog.php | 16 +++++----- .../workflow/src/Doctrine/Entity/JobState.php | 7 +++-- notify/api/src/Entity/Contact.php | 14 +++++---- notify/api/src/Entity/FailedEvent.php | 6 ++-- notify/api/src/Entity/TopicSubscriber.php | 8 +++-- uploader/api/src/Entity/Asset.php | 17 +++++----- uploader/api/src/Entity/Commit.php | 21 +++++++------ uploader/api/src/Entity/FailedEvent.php | 6 ++-- uploader/api/src/Entity/FormSchema.php | 17 +++++----- uploader/api/src/Entity/Target.php | 23 +++++++------- uploader/api/src/Entity/TargetParams.php | 18 ++++++----- 69 files changed, 396 insertions(+), 303 deletions(-) diff --git a/databox/api/config/packages/fos_elastica.yaml b/databox/api/config/packages/fos_elastica.yaml index dacb9f0c5..e0941fc8d 100644 --- a/databox/api/config/packages/fos_elastica.yaml +++ b/databox/api/config/packages/fos_elastica.yaml @@ -1,5 +1,6 @@ parameters: es_index_prefix: '%env(ELASTICSEARCH_INDEX_PREFIX)%' + elastica.use_alias: true # Read the documentation: https://github.com/FriendsOfSymfony/FOSElasticaBundle/blob/master/doc/setup.md fos_elastica: @@ -7,7 +8,7 @@ fos_elastica: default: { url: '%env(ELASTICSEARCH_URL)%/' } indexes: asset: - use_alias: true + use_alias: '%elastica.use_alias%' index_name: "%es_index_prefix%asset_%kernel.environment%" settings: index: @@ -85,7 +86,7 @@ fos_elastica: listener: { enabled: false } collection: - use_alias: true + use_alias: '%elastica.use_alias%' index_name: "%es_index_prefix%collection_%kernel.environment%" settings: index: @@ -129,7 +130,7 @@ fos_elastica: listener: { enabled: false } asset_data_template: - use_alias: true + use_alias: '%elastica.use_alias%' index_name: "%es_index_prefix%asset_data_template_%kernel.environment%" properties: name: @@ -159,3 +160,11 @@ fos_elastica: driver: orm model: App\Entity\Template\AssetDataTemplate listener: { enabled: false } + +when@dev: + parameters: + elastica.use_alias: false + +when@test: + parameters: + elastica.use_alias: false diff --git a/databox/api/src/Api/Model/Output/Traits/CreatedAtDTOTrait.php b/databox/api/src/Api/Model/Output/Traits/CreatedAtDTOTrait.php index a6b243a95..66859a25b 100644 --- a/databox/api/src/Api/Model/Output/Traits/CreatedAtDTOTrait.php +++ b/databox/api/src/Api/Model/Output/Traits/CreatedAtDTOTrait.php @@ -11,14 +11,14 @@ trait CreatedAtDTOTrait { #[Groups(['dates'])] #[ApiProperty] - protected \DateTimeInterface $createdAt; + protected \DateTimeImmutable $createdAt; - public function getCreatedAt(): \DateTimeInterface + public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } - public function setCreatedAt(\DateTimeInterface $createdAt): void + public function setCreatedAt(\DateTimeImmutable $createdAt): void { $this->createdAt = $createdAt; } diff --git a/databox/api/src/Api/Model/Output/Traits/UpdatedAtDTOTrait.php b/databox/api/src/Api/Model/Output/Traits/UpdatedAtDTOTrait.php index 0f284f8b3..66094125f 100644 --- a/databox/api/src/Api/Model/Output/Traits/UpdatedAtDTOTrait.php +++ b/databox/api/src/Api/Model/Output/Traits/UpdatedAtDTOTrait.php @@ -11,14 +11,14 @@ trait UpdatedAtDTOTrait { #[Groups(['dates'])] #[ApiProperty] - protected \DateTimeInterface $updatedAt; + protected \DateTimeImmutable $updatedAt; - public function getUpdatedAt(): \DateTimeInterface + public function getUpdatedAt(): \DateTimeImmutable { return $this->updatedAt; } - public function setUpdatedAt(\DateTimeInterface $updatedAt): void + public function setUpdatedAt(\DateTimeImmutable $updatedAt): void { $this->updatedAt = $updatedAt; } diff --git a/databox/api/src/Attribute/Type/DateAttributeType.php b/databox/api/src/Attribute/Type/DateAttributeType.php index 0156c5bb0..d62a5bb95 100644 --- a/databox/api/src/Attribute/Type/DateAttributeType.php +++ b/databox/api/src/Attribute/Type/DateAttributeType.php @@ -14,15 +14,9 @@ public static function getName(): string public function getGroupValueLabel($value): ?string { if ($value instanceof \DateTimeInterface) { - if ($value instanceof \DateTimeImmutable) { - $date = \DateTime::createFromImmutable($value); - } else { - $date = clone $value; - } - - $date->setTime(0, 0); - - return $date->format(\DateTimeInterface::ATOM); + return \DateTimeImmutable::createFromInterface($value) + ->setTime(0, 0) + ->format(\DateTimeInterface::ATOM); } return parent::getGroupValueLabel($value); diff --git a/databox/api/src/Doctrine/Listener/SoftDeleteableInterface.php b/databox/api/src/Doctrine/Listener/SoftDeleteableInterface.php index e76072ece..115da9085 100644 --- a/databox/api/src/Doctrine/Listener/SoftDeleteableInterface.php +++ b/databox/api/src/Doctrine/Listener/SoftDeleteableInterface.php @@ -6,5 +6,5 @@ interface SoftDeleteableInterface { - public function getDeletedAt(): ?\DateTimeInterface; + public function getDeletedAt(): ?\DateTimeImmutable; } diff --git a/databox/api/src/Entity/AbstractUuidEntity.php b/databox/api/src/Entity/AbstractUuidEntity.php index d9acc6032..ace1bf17b 100644 --- a/databox/api/src/Entity/AbstractUuidEntity.php +++ b/databox/api/src/Entity/AbstractUuidEntity.php @@ -5,7 +5,9 @@ namespace App\Entity; use ApiPlatform\Metadata\ApiProperty; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Symfony\Component\Serializer\Annotation\Groups; @@ -14,7 +16,7 @@ abstract class AbstractUuidEntity { #[Groups(['_'])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ApiProperty(identifier: true)] private string $id; diff --git a/databox/api/src/Entity/Admin/ESIndexState.php b/databox/api/src/Entity/Admin/ESIndexState.php index c8bdb08fa..116c5b754 100644 --- a/databox/api/src/Entity/Admin/ESIndexState.php +++ b/databox/api/src/Entity/Admin/ESIndexState.php @@ -7,6 +7,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Table] @@ -17,10 +18,10 @@ class ESIndexState extends AbstractUuidEntity use CreatedAtTrait; use UpdatedAtTrait; - #[ORM\Column(type: 'string', length: 150, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 150, nullable: false)] private string $indexName; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $mapping; public function getIndexName(): string diff --git a/databox/api/src/Entity/Admin/PopulatePass.php b/databox/api/src/Entity/Admin/PopulatePass.php index 8fdae91f2..abdfa156a 100644 --- a/databox/api/src/Entity/Admin/PopulatePass.php +++ b/databox/api/src/Entity/Admin/PopulatePass.php @@ -7,6 +7,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Traits\CreatedAtTrait; use App\Util\Time; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Table] @@ -15,22 +16,22 @@ class PopulatePass extends AbstractUuidEntity { use CreatedAtTrait; - #[ORM\Column(type: 'datetime', nullable: true)] - protected ?\DateTimeInterface $endedAt = null; + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] + protected ?\DateTimeImmutable $endedAt = null; - #[ORM\Column(type: 'bigint', nullable: false)] + #[ORM\Column(type: Types::BIGINT, nullable: false)] private int $documentCount; - #[ORM\Column(type: 'bigint', nullable: true)] + #[ORM\Column(type: Types::BIGINT, nullable: true)] private ?int $progress = null; - #[ORM\Column(type: 'string', length: 255, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] private string $indexName; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $mapping; - #[ORM\Column(type: 'string', nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] private ?string $error = null; public function getTimeTaken(): ?int @@ -77,12 +78,12 @@ public function setMapping(array $mapping): void $this->mapping = $mapping; } - public function getEndedAt(): ?\DateTimeInterface + public function getEndedAt(): ?\DateTimeImmutable { return $this->endedAt; } - public function setEndedAt(?\DateTimeInterface $endedAt): void + public function setEndedAt(?\DateTimeImmutable $endedAt): void { $this->endedAt = $endedAt; } diff --git a/databox/api/src/Entity/Basket/Basket.php b/databox/api/src/Entity/Basket/Basket.php index 1071476fd..1978f88ab 100644 --- a/databox/api/src/Entity/Basket/Basket.php +++ b/databox/api/src/Entity/Basket/Basket.php @@ -6,6 +6,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Core\Collection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] diff --git a/databox/api/src/Entity/Core/AbstractBaseAttribute.php b/databox/api/src/Entity/Core/AbstractBaseAttribute.php index ec82ae1b9..cc5f2286a 100644 --- a/databox/api/src/Entity/Core/AbstractBaseAttribute.php +++ b/databox/api/src/Entity/Core/AbstractBaseAttribute.php @@ -7,6 +7,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\MappedSuperclass] @@ -15,13 +16,13 @@ abstract class AbstractBaseAttribute extends AbstractUuidEntity use CreatedAtTrait; use UpdatedAtTrait; - #[ORM\Column(type: 'string', length: 10, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 10, nullable: true)] private ?string $locale = null; - #[ORM\Column(type: 'integer', nullable: false)] + #[ORM\Column(type: Types::INTEGER, nullable: false)] private int $position = 0; - #[ORM\Column(type: 'text', nullable: false)] + #[ORM\Column(type: Types::TEXT, nullable: false)] private ?string $value = null; /** @@ -64,12 +65,12 @@ public function setPosition(int $position): void $this->position = $position; } - public function setCreatedAt(\DateTimeInterface $createdAt): void + public function setCreatedAt(\DateTimeImmutable $createdAt): void { $this->createdAt = $createdAt; } - public function setUpdatedAt(\DateTimeInterface $updatedAt): void + public function setUpdatedAt(\DateTimeImmutable $updatedAt): void { $this->updatedAt = $updatedAt; } diff --git a/databox/api/src/Entity/Core/AlternateUrl.php b/databox/api/src/Entity/Core/AlternateUrl.php index bb56152a7..81ac12e80 100644 --- a/databox/api/src/Entity/Core/AlternateUrl.php +++ b/databox/api/src/Entity/Core/AlternateUrl.php @@ -8,6 +8,7 @@ use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\WorkspaceTrait; use App\Repository\Core\AttributeRepository; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity(repositoryClass: AttributeRepository::class)] @@ -16,10 +17,10 @@ class AlternateUrl extends AbstractUuidEntity use CreatedAtTrait; use WorkspaceTrait; - #[ORM\Column(type: 'string', length: 50, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 50, nullable: false)] private ?string $type = null; - #[ORM\Column(type: 'string', length: 255, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] private ?string $label = null; public function getType(): ?string diff --git a/databox/api/src/Entity/Core/Asset.php b/databox/api/src/Entity/Core/Asset.php index c135eec11..bd74a1786 100644 --- a/databox/api/src/Entity/Core/Asset.php +++ b/databox/api/src/Entity/Core/Asset.php @@ -42,6 +42,7 @@ use App\Security\Voter\AssetVoter; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use FOS\ElasticaBundle\Transformer\HighlightableModelInterface; use Symfony\Component\Serializer\Annotation\Groups; @@ -121,28 +122,28 @@ class Asset extends AbstractUuidEntity implements HighlightableModelInterface, W final public const GROUP_LIST = 'asset:index'; final public const GROUP_WRITE = 'asset:w'; - #[ORM\Column(type: 'integer', nullable: false)] + #[ORM\Column(type: Types::INTEGER, nullable: false)] private int $microseconds = 0; - #[ORM\Column(type: 'integer', nullable: false)] + #[ORM\Column(type: Types::INTEGER, nullable: false)] private int $sequence = 0; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $title = null; - #[ORM\Column(type: 'string', length: 36)] + #[ORM\Column(type: Types::STRING, length: 36)] private ?string $ownerId = null; /** * Unique key by workspace. Used to prevent duplicates. */ - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $key = null; /** * Token sent to Uploader. */ - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $pendingUploadToken = null; #[ORM\OneToMany(mappedBy: 'asset', targetEntity: CollectionAsset::class, cascade: ['remove'])] @@ -181,14 +182,14 @@ class Asset extends AbstractUuidEntity implements HighlightableModelInterface, W * Last update time of attribute. */ #[Groups(['dates'])] - #[ORM\Column(type: 'datetime_immutable')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] protected ?\DateTimeImmutable $attributesEditedAt = null; /** * Last update time of tags. */ #[Groups(['dates'])] - #[ORM\Column(type: 'datetime_immutable')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] protected ?\DateTimeImmutable $tagsEditedAt = null; /** diff --git a/databox/api/src/Entity/Core/AssetFileVersion.php b/databox/api/src/Entity/Core/AssetFileVersion.php index 98ddcecdc..5b4c9b7d0 100644 --- a/databox/api/src/Entity/Core/AssetFileVersion.php +++ b/databox/api/src/Entity/Core/AssetFileVersion.php @@ -12,6 +12,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Traits\CreatedAtTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -37,7 +38,7 @@ class AssetFileVersion extends AbstractUuidEntity final public const GROUP_READ = 'afv:read'; final public const GROUP_LIST = 'afv:index'; - #[ORM\Column(type: 'string', length: 50, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 50, nullable: true)] private ?string $versionName = null; #[ORM\ManyToOne(targetEntity: Asset::class)] @@ -50,7 +51,7 @@ class AssetFileVersion extends AbstractUuidEntity #[Groups([AssetFileVersion::GROUP_LIST])] private ?File $file = null; - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] private array $context = []; public function getVersionName(): ?string diff --git a/databox/api/src/Entity/Core/AssetRelationship.php b/databox/api/src/Entity/Core/AssetRelationship.php index ef104ee48..a6f4210f6 100644 --- a/databox/api/src/Entity/Core/AssetRelationship.php +++ b/databox/api/src/Entity/Core/AssetRelationship.php @@ -8,6 +8,7 @@ use App\Entity\Integration\WorkspaceIntegration; use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Table] @@ -20,13 +21,13 @@ class AssetRelationship extends AbstractUuidEntity /** * The type of relationship. */ - #[ORM\Column(type: 'string', length: 20)] + #[ORM\Column(type: Types::STRING, length: 20)] private ?string $type = null; /** * Whether the two assets can't live alone (being deleted, moved to another collection...). */ - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] private bool $sticky = false; #[ORM\ManyToOne(targetEntity: Asset::class)] diff --git a/databox/api/src/Entity/Core/AssetRendition.php b/databox/api/src/Entity/Core/AssetRendition.php index f48c17e3b..4cfe6ca9d 100644 --- a/databox/api/src/Entity/Core/AssetRendition.php +++ b/databox/api/src/Entity/Core/AssetRendition.php @@ -18,6 +18,7 @@ use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; use App\Repository\Core\AssetRenditionRepository; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; diff --git a/databox/api/src/Entity/Core/AssetTitleAttribute.php b/databox/api/src/Entity/Core/AssetTitleAttribute.php index c839b878d..e3d8c4328 100644 --- a/databox/api/src/Entity/Core/AssetTitleAttribute.php +++ b/databox/api/src/Entity/Core/AssetTitleAttribute.php @@ -5,6 +5,7 @@ namespace App\Entity\Core; use App\Entity\AbstractUuidEntity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] @@ -18,13 +19,13 @@ class AssetTitleAttribute extends AbstractUuidEntity #[ORM\JoinColumn(nullable: false)] protected ?AttributeDefinition $definition = null; - #[ORM\Column(type: 'smallint', nullable: false)] + #[ORM\Column(type: Types::SMALLINT, nullable: false)] private int $priority = 0; /** * Whether to override "title" attribute set on asset. */ - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $overrides = false; public function getWorkspace(): ?Workspace diff --git a/databox/api/src/Entity/Core/Attribute.php b/databox/api/src/Entity/Core/Attribute.php index 002c696bf..42f142568 100644 --- a/databox/api/src/Entity/Core/Attribute.php +++ b/databox/api/src/Entity/Core/Attribute.php @@ -23,7 +23,9 @@ use App\Entity\SearchDeleteDependencyInterface; use App\Repository\Core\AttributeRepository; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; #[ApiResource( shortName: 'attribute', @@ -88,7 +90,7 @@ class Attribute extends AbstractBaseAttribute implements SearchDeleteDependencyI #[ORM\JoinColumn(nullable: false)] private ?Asset $asset = null; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $locked = false; #[ORM\ManyToOne(targetEntity: AttributeDefinition::class, inversedBy: 'attributes')] @@ -98,7 +100,7 @@ class Attribute extends AbstractBaseAttribute implements SearchDeleteDependencyI /** * Unique ID to group translations of the same attribute. */ - #[ORM\Column(type: 'uuid', nullable: true)] + #[ORM\Column(type: UuidType::NAME, nullable: true)] private ?string $translationId = null; /** @@ -111,7 +113,7 @@ class Attribute extends AbstractBaseAttribute implements SearchDeleteDependencyI /** * Hashed value of the original translated string. */ - #[ORM\Column(type: 'string', length: 32, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 32, nullable: true)] private ?string $translationOriginHash = null; #[ORM\OneToMany(targetEntity: Attribute::class, mappedBy: 'translationOrigin', cascade: ['remove'])] @@ -128,28 +130,28 @@ class Attribute extends AbstractBaseAttribute implements SearchDeleteDependencyI */ private ?array $highlights = null; - #[ORM\Column(type: 'smallint', nullable: false)] + #[ORM\Column(type: Types::SMALLINT, nullable: false)] private ?int $origin = null; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $originVendor = null; - #[ORM\Column(type: 'uuid', nullable: true)] + #[ORM\Column(type: UuidType::NAME, nullable: true)] private ?string $originUserId = null; /** * Could include vendor version, AI parameters, etc. */ - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $originVendorContext = null; - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $coordinates = null; - #[ORM\Column(type: 'smallint', nullable: true)] + #[ORM\Column(type: Types::SMALLINT, nullable: true)] private int $status = self::STATUS_VALID; - #[ORM\Column(type: 'float', nullable: false)] + #[ORM\Column(type: Types::FLOAT, nullable: false)] private float $confidence = 1.0; public ?AttributeBatchUpdateInput $batchUpdate = null; diff --git a/databox/api/src/Entity/Core/AttributeClass.php b/databox/api/src/Entity/Core/AttributeClass.php index 9a6e1e6a2..ec0cace84 100644 --- a/databox/api/src/Entity/Core/AttributeClass.php +++ b/databox/api/src/Entity/Core/AttributeClass.php @@ -19,6 +19,7 @@ use App\Entity\Traits\WorkspaceTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -59,15 +60,15 @@ class AttributeClass extends AbstractUuidEntity implements AclObjectInterface, \ protected ?Workspace $workspace = null; #[Groups([AttributeClass::GROUP_LIST, AttributeDefinition::GROUP_LIST, AttributeDefinition::GROUP_READ])] - #[ORM\Column(type: 'string', length: 80)] + #[ORM\Column(type: Types::STRING, length: 80)] private ?string $name = null; #[Groups([AttributeClass::GROUP_LIST])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] private ?bool $editable = null; #[Groups([AttributeClass::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private ?bool $public = null; /** @@ -79,7 +80,7 @@ class AttributeClass extends AbstractUuidEntity implements AclObjectInterface, \ /** * Unique key by workspace. Used to prevent duplicates. */ - #[ORM\Column(type: 'string', length: 150, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 150, nullable: true)] private ?string $key = null; public function __construct() diff --git a/databox/api/src/Entity/Core/AttributeDefinition.php b/databox/api/src/Entity/Core/AttributeDefinition.php index b14773075..82eb16991 100644 --- a/databox/api/src/Entity/Core/AttributeDefinition.php +++ b/databox/api/src/Entity/Core/AttributeDefinition.php @@ -24,6 +24,7 @@ use App\Entity\Traits\WorkspaceTrait; use App\Repository\Core\AttributeDefinitionRepository; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; @@ -106,10 +107,10 @@ class AttributeDefinition extends AbstractUuidEntity implements \Stringable private ?DoctrineCollection $attributes = null; #[Groups([Asset::GROUP_LIST, Asset::GROUP_READ, AttributeDefinition::GROUP_LIST, Attribute::GROUP_LIST])] - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] private ?string $name = null; - #[ORM\Column(type: 'string', length: 100, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true)] #[Gedmo\Slug(fields: ['name'], style: 'lower', unique: false, separator: '')] private ?string $slug = null; @@ -118,63 +119,63 @@ class AttributeDefinition extends AbstractUuidEntity implements \Stringable * If null, applied to all files. */ #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'string', length: 100, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true)] private ?string $fileType = null; #[Groups([AttributeDefinition::GROUP_LIST, Asset::GROUP_LIST])] - #[ORM\Column(type: 'string', length: 50, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 50, nullable: false)] private string $fieldType = TextAttributeType::NAME; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $searchable = true; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $facetEnabled = false; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $sortable = false; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $translatable = false; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $multiple = false; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $allowInvalid = false; #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'integer', nullable: true)] + #[ORM\Column(type: Types::INTEGER, nullable: true)] private ?int $searchBoost = null; /** * Initialize attributes after asset creation; key=locale. */ #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] private ?array $initialValues = null; /** * Resolve this template (TWIG syntax) if no user value provided. */ #[Groups([AttributeDefinition::GROUP_LIST])] - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] private ?array $fallback = null; /** * Unique key by workspace. Used to prevent duplicates. */ - #[ORM\Column(type: 'string', length: 150, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 150, nullable: true)] private ?string $key = null; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'smallint', nullable: false)] + #[ORM\Column(type: Types::SMALLINT, nullable: false)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private int $position = 0; diff --git a/databox/api/src/Entity/Core/Collection.php b/databox/api/src/Entity/Core/Collection.php index 129a40bb7..a955f82c0 100644 --- a/databox/api/src/Entity/Core/Collection.php +++ b/databox/api/src/Entity/Core/Collection.php @@ -33,6 +33,7 @@ use App\Repository\Core\CollectionRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -96,10 +97,10 @@ class Collection extends AbstractUuidEntity implements SoftDeleteableInterface, final public const GROUP_CHILDREN = 'coll:ic'; final public const GROUP_2LEVEL_CHILDREN = 'coll:2lc'; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $title = null; - #[ORM\Column(type: 'string', length: 36)] + #[ORM\Column(type: Types::STRING, length: 36)] private ?string $ownerId = null; #[ORM\ManyToOne(targetEntity: Collection::class, inversedBy: 'children')] @@ -134,7 +135,7 @@ class Collection extends AbstractUuidEntity implements SoftDeleteableInterface, /** * Unique key by workspace. Used to prevent duplicates. */ - #[ORM\Column(type: 'string', length: 4096, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 4096, nullable: true)] private ?string $key = null; public function __construct() diff --git a/databox/api/src/Entity/Core/CollectionAsset.php b/databox/api/src/Entity/Core/CollectionAsset.php index b8d275c8c..f4d7df990 100644 --- a/databox/api/src/Entity/Core/CollectionAsset.php +++ b/databox/api/src/Entity/Core/CollectionAsset.php @@ -11,6 +11,7 @@ use App\Entity\SearchDependencyInterface; use App\Entity\Traits\CreatedAtTrait; use App\Repository\Core\CollectionAssetRepository; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ApiResource( diff --git a/databox/api/src/Entity/Core/File.php b/databox/api/src/Entity/Core/File.php index 3d19851a1..54d09c380 100644 --- a/databox/api/src/Entity/Core/File.php +++ b/databox/api/src/Entity/Core/File.php @@ -10,6 +10,7 @@ use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; use App\Entity\Traits\WorkspaceTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -49,40 +50,40 @@ class File extends AbstractUuidEntity implements \Stringable /** * The MIME type. */ - #[ORM\Column(type: 'string', length: 100, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true)] private ?string $type = null; - #[ORM\Column(type: 'bigint', nullable: true)] + #[ORM\Column(type: Types::BIGINT, nullable: true)] private ?int $size = null; - #[ORM\Column(type: 'string', length: 64, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 64, nullable: true)] private ?string $checksum = null; - #[ORM\Column(type: 'string', length: 255, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] private ?string $path = null; /** * Is path accessible from browser. */ - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $pathPublic = true; - #[ORM\Column(type: 'string', length: 150, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 150, nullable: false)] private ?string $storage = null; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $originalName = null; - #[ORM\Column(type: 'string', length: 20, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 20, nullable: true)] private ?string $extension = null; - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] private ?array $alternateUrls = null; /** * Normalized metadata. */ - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] private ?array $metadata = null; public function getPath(): ?string diff --git a/databox/api/src/Entity/Core/RenditionClass.php b/databox/api/src/Entity/Core/RenditionClass.php index 0fcbbca73..2860b7550 100644 --- a/databox/api/src/Entity/Core/RenditionClass.php +++ b/databox/api/src/Entity/Core/RenditionClass.php @@ -18,6 +18,7 @@ use App\Entity\Traits\WorkspaceTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -56,11 +57,11 @@ class RenditionClass extends AbstractUuidEntity implements \Stringable protected ?Workspace $workspace = null; #[Groups([RenditionClass::GROUP_LIST, RenditionClass::GROUP_READ])] - #[ORM\Column(type: 'string', length: 80)] + #[ORM\Column(type: Types::STRING, length: 80)] private ?string $name = null; #[Groups([RenditionClass::GROUP_LIST, RenditionClass::GROUP_READ])] - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $public = false; /** diff --git a/databox/api/src/Entity/Core/RenditionDefinition.php b/databox/api/src/Entity/Core/RenditionDefinition.php index a4396f7f5..426d2e016 100644 --- a/databox/api/src/Entity/Core/RenditionDefinition.php +++ b/databox/api/src/Entity/Core/RenditionDefinition.php @@ -21,6 +21,7 @@ use App\Entity\Traits\WorkspaceTrait; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -87,7 +88,7 @@ class RenditionDefinition extends AbstractUuidEntity implements \Stringable protected ?Workspace $workspace = null; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'string', length: 80)] + #[ORM\Column(type: Types::STRING, length: 80)] private ?string $name = null; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] @@ -96,41 +97,41 @@ class RenditionDefinition extends AbstractUuidEntity implements \Stringable protected ?RenditionClass $class = null; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] private bool $download = true; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private bool $pickSourceFile = false; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private bool $useAsOriginal = false; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private bool $useAsPreview = false; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private bool $useAsThumbnail = false; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private bool $useAsThumbnailActive = false; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'text')] + #[ORM\Column(type: Types::TEXT)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private ?string $definition = ''; #[Groups([RenditionDefinition::GROUP_LIST, RenditionDefinition::GROUP_READ, RenditionDefinition::GROUP_WRITE])] - #[ORM\Column(type: 'smallint', nullable: false)] + #[ORM\Column(type: Types::SMALLINT, nullable: false)] #[ApiProperty(security: "is_granted('READ_ADMIN', object)")] private int $priority = 0; diff --git a/databox/api/src/Entity/Core/RenditionRule.php b/databox/api/src/Entity/Core/RenditionRule.php index 1a3f9bda4..4773f7185 100644 --- a/databox/api/src/Entity/Core/RenditionRule.php +++ b/databox/api/src/Entity/Core/RenditionRule.php @@ -22,7 +22,9 @@ use App\Repository\Core\RenditionRuleRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; #[ApiResource( shortName: 'rendition-rule', @@ -69,16 +71,16 @@ class RenditionRule extends AbstractUuidEntity self::TYPE_COLLECTION => Collection::class, ]; - #[ORM\Column(type: 'smallint')] + #[ORM\Column(type: Types::SMALLINT)] protected ?int $userType = null; - #[ORM\Column(type: 'string', length: 36, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 36, nullable: true)] protected ?string $userId = null; - #[ORM\Column(type: 'smallint')] + #[ORM\Column(type: Types::SMALLINT)] protected int $objectType; - #[ORM\Column(type: 'uuid', nullable: false)] + #[ORM\Column(type: UuidType::NAME, nullable: false)] protected string $objectId; /** diff --git a/databox/api/src/Entity/Core/Tag.php b/databox/api/src/Entity/Core/Tag.php index 36235fcfe..01c0b1c10 100644 --- a/databox/api/src/Entity/Core/Tag.php +++ b/databox/api/src/Entity/Core/Tag.php @@ -19,6 +19,7 @@ use App\Entity\Traits\UpdatedAtTrait; use App\Entity\Traits\WorkspaceTrait; use App\Entity\TranslatableInterface; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -50,10 +51,10 @@ class Tag extends AbstractUuidEntity implements TranslatableInterface, \Stringab final public const GROUP_READ = 'tag:read'; final public const GROUP_LIST = 'tag:index'; - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] private string $name; - #[ORM\Column(type: 'string', length: 6, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 6, nullable: true)] private ?string $color = null; /** diff --git a/databox/api/src/Entity/Core/TagFilterRule.php b/databox/api/src/Entity/Core/TagFilterRule.php index caf58b5a5..40cb0fc76 100644 --- a/databox/api/src/Entity/Core/TagFilterRule.php +++ b/databox/api/src/Entity/Core/TagFilterRule.php @@ -19,7 +19,9 @@ use App\Repository\Core\TagFilterRuleRepository; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; #[ApiResource( shortName: 'tag-filter-rule', @@ -63,16 +65,16 @@ class TagFilterRule extends AbstractUuidEntity self::TYPE_COLLECTION => Collection::class, ]; - #[ORM\Column(type: 'smallint')] + #[ORM\Column(type: Types::SMALLINT)] protected ?int $userType = null; - #[ORM\Column(type: 'string', length: 36, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 36, nullable: true)] protected ?string $userId = null; - #[ORM\Column(type: 'smallint')] + #[ORM\Column(type: Types::SMALLINT)] protected int $objectType; - #[ORM\Column(type: 'uuid', nullable: false)] + #[ORM\Column(type: UuidType::NAME, nullable: false)] protected string $objectId; #[ORM\JoinTable(name: 'tfr_includes')] diff --git a/databox/api/src/Entity/Core/UserPreference.php b/databox/api/src/Entity/Core/UserPreference.php index 02d438f5e..99f634a48 100644 --- a/databox/api/src/Entity/Core/UserPreference.php +++ b/databox/api/src/Entity/Core/UserPreference.php @@ -7,6 +7,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] @@ -15,10 +16,10 @@ class UserPreference extends AbstractUuidEntity use CreatedAtTrait; use UpdatedAtTrait; - #[ORM\Column(type: 'string', length: 36, unique: true, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 36, unique: true, nullable: false)] private ?string $userId = null; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $data = []; public function getUserId(): ?string diff --git a/databox/api/src/Entity/Core/Workspace.php b/databox/api/src/Entity/Core/Workspace.php index bc04ddf04..e29d07355 100644 --- a/databox/api/src/Entity/Core/Workspace.php +++ b/databox/api/src/Entity/Core/Workspace.php @@ -26,6 +26,7 @@ use App\Security\Voter\AbstractVoter; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; @@ -88,25 +89,25 @@ class Workspace extends AbstractUuidEntity implements SoftDeleteableInterface, A final public const GROUP_READ = 'workspace:read'; final public const GROUP_LIST = 'workspace:index'; - #[ORM\Column(type: 'string', length: 255, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] private ?string $name = null; - #[ORM\Column(type: 'string', length: 50, unique: true, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 50, unique: true, nullable: false)] private ?string $slug = null; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $ownerId = null; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $public = false; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $config = []; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $enabledLocales = []; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private ?array $localeFallbacks = ['en']; /** diff --git a/databox/api/src/Entity/FailedEvent.php b/databox/api/src/Entity/FailedEvent.php index 8c40f816a..43b21d8b2 100644 --- a/databox/api/src/Entity/FailedEvent.php +++ b/databox/api/src/Entity/FailedEvent.php @@ -5,8 +5,10 @@ namespace App\Entity; use Arthem\Bundle\RabbitBundle\Model\FailedEvent as BaseFailedEvent; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -16,12 +18,12 @@ class FailedEvent extends BaseFailedEvent * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private ?\DateTime $createdAt = null; public function __construct() diff --git a/databox/api/src/Entity/Integration/IntegrationData.php b/databox/api/src/Entity/Integration/IntegrationData.php index c030576d0..06674a59a 100644 --- a/databox/api/src/Entity/Integration/IntegrationData.php +++ b/databox/api/src/Entity/Integration/IntegrationData.php @@ -15,6 +15,7 @@ use App\Entity\Core\File; use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -51,15 +52,15 @@ class IntegrationData extends AbstractUuidEntity #[ORM\JoinColumn(nullable: true)] private ?File $file = null; - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] #[Groups([IntegrationData::GROUP_LIST])] private ?string $name = null; - #[ORM\Column(type: 'string', length: 100, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true)] #[Groups([IntegrationData::GROUP_LIST])] private ?string $keyId = null; - #[ORM\Column(type: 'text', nullable: false)] + #[ORM\Column(type: Types::TEXT, nullable: false)] #[Groups([IntegrationData::GROUP_LIST])] private $value; diff --git a/databox/api/src/Entity/Integration/WorkspaceEnv.php b/databox/api/src/Entity/Integration/WorkspaceEnv.php index 9cdc6a687..0dd5f7d52 100644 --- a/databox/api/src/Entity/Integration/WorkspaceEnv.php +++ b/databox/api/src/Entity/Integration/WorkspaceEnv.php @@ -10,6 +10,7 @@ use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; use App\Entity\Traits\WorkspaceTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -24,12 +25,12 @@ class WorkspaceEnv extends AbstractUuidEntity use UpdatedAtTrait; use WorkspaceTrait; - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] #[Groups(['env:index'])] #[Assert\NotBlank] private ?string $name = null; - #[ORM\Column(type: 'text', nullable: false)] + #[ORM\Column(type: Types::TEXT, nullable: false)] #[Assert\NotNull] private ?string $value = null; diff --git a/databox/api/src/Entity/Integration/WorkspaceIntegration.php b/databox/api/src/Entity/Integration/WorkspaceIntegration.php index 4c5ef2bc6..dcd2ed068 100644 --- a/databox/api/src/Entity/Integration/WorkspaceIntegration.php +++ b/databox/api/src/Entity/Integration/WorkspaceIntegration.php @@ -20,6 +20,7 @@ use App\Integration\Exception\CircularReferenceException; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -53,26 +54,26 @@ class WorkspaceIntegration extends AbstractUuidEntity implements \Stringable final public const GROUP_READ = 'wi:read'; final public const GROUP_LIST = 'wi:index'; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] #[Groups([WorkspaceIntegration::GROUP_LIST])] private ?string $title = null; - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] #[Groups([WorkspaceIntegration::GROUP_LIST])] private ?string $integration = null; #[ORM\ManyToMany(targetEntity: WorkspaceIntegration::class)] private ?Collection $needs = null; - #[ORM\Column(type: 'string', length: 2048, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 2048, nullable: true)] #[Groups([WorkspaceIntegration::GROUP_LIST])] private ?string $if = null; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] #[Groups([WorkspaceIntegration::GROUP_LIST])] private bool $enabled = true; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $config = []; private ?string $optionsJson = null; diff --git a/databox/api/src/Entity/Integration/WorkspaceSecret.php b/databox/api/src/Entity/Integration/WorkspaceSecret.php index e875f543f..bd493ec14 100644 --- a/databox/api/src/Entity/Integration/WorkspaceSecret.php +++ b/databox/api/src/Entity/Integration/WorkspaceSecret.php @@ -10,6 +10,7 @@ use App\Entity\Traits\CreatedAtTrait; use App\Entity\Traits\UpdatedAtTrait; use App\Entity\Traits\WorkspaceTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -24,12 +25,12 @@ class WorkspaceSecret extends AbstractUuidEntity use UpdatedAtTrait; use WorkspaceTrait; - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] #[Groups(['secret:index'])] #[Assert\NotBlank] private ?string $name = null; - #[ORM\Column(type: 'text', nullable: false)] + #[ORM\Column(type: Types::TEXT, nullable: false)] private ?string $value = null; private ?string $plainValue = null; diff --git a/databox/api/src/Entity/Media/MediaIndex.php b/databox/api/src/Entity/Media/MediaIndex.php index b82712ad7..0633d28e2 100644 --- a/databox/api/src/Entity/Media/MediaIndex.php +++ b/databox/api/src/Entity/Media/MediaIndex.php @@ -7,6 +7,7 @@ use App\Entity\AbstractUuidEntity; use App\Entity\Core\Collection; use App\Entity\Traits\WorkspaceTrait; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] diff --git a/databox/api/src/Entity/Template/AssetDataTemplate.php b/databox/api/src/Entity/Template/AssetDataTemplate.php index 627e1371a..c733f48d7 100644 --- a/databox/api/src/Entity/Template/AssetDataTemplate.php +++ b/databox/api/src/Entity/Template/AssetDataTemplate.php @@ -26,6 +26,7 @@ use App\Entity\WithOwnerIdInterface; use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -78,21 +79,21 @@ class AssetDataTemplate extends AbstractUuidEntity implements AclObjectInterface /** * Template name. */ - #[ORM\Column(type: 'string', length: 255, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] private ?string $name = null; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] #[Groups([AssetDataTemplate::GROUP_READ])] private bool $public = false; - #[ORM\Column(type: 'string', length: 36)] + #[ORM\Column(type: Types::STRING, length: 36)] #[Groups([AssetDataTemplate::GROUP_READ])] private ?string $ownerId = null; /** * Asset title. */ - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] #[Groups([AssetDataTemplate::GROUP_READ])] private ?string $title = null; @@ -111,13 +112,13 @@ class AssetDataTemplate extends AbstractUuidEntity implements AclObjectInterface #[ORM\JoinColumn(nullable: true)] private ?Collection $collection = null; - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] private bool $includeCollectionChildren = false; - #[ORM\Column(type: 'smallint', nullable: true)] + #[ORM\Column(type: Types::SMALLINT, nullable: true)] private ?int $privacy = null; - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] private array $data = []; public function __construct() diff --git a/databox/api/src/Entity/Template/TemplateAttribute.php b/databox/api/src/Entity/Template/TemplateAttribute.php index 03409f59c..89f9f828e 100644 --- a/databox/api/src/Entity/Template/TemplateAttribute.php +++ b/databox/api/src/Entity/Template/TemplateAttribute.php @@ -16,7 +16,9 @@ use App\Entity\Core\Attribute; use App\Entity\Core\AttributeDefinition; use Doctrine\Common\Collections\Collection as DoctrineCollection; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Symfony\Component\Serializer\Annotation\Groups; #[ApiResource( @@ -49,7 +51,7 @@ class TemplateAttribute extends AbstractBaseAttribute /** * Unique ID to group translations of the same attribute. */ - #[ORM\Column(type: 'uuid', nullable: true)] + #[ORM\Column(type: UuidType::NAME, nullable: true)] private ?string $translationId = null; /** @@ -62,7 +64,7 @@ class TemplateAttribute extends AbstractBaseAttribute /** * Hashed value of the original translated string. */ - #[ORM\Column(type: 'string', length: 32, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 32, nullable: true)] private ?string $translationOriginHash = null; #[ORM\OneToMany(targetEntity: TemplateAttribute::class, mappedBy: 'translationOrigin', cascade: ['remove'])] diff --git a/databox/api/src/Entity/Traits/CreatedAtTrait.php b/databox/api/src/Entity/Traits/CreatedAtTrait.php index ab6e9fa0f..0919c39cd 100644 --- a/databox/api/src/Entity/Traits/CreatedAtTrait.php +++ b/databox/api/src/Entity/Traits/CreatedAtTrait.php @@ -4,18 +4,19 @@ namespace App\Entity\Traits; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; trait CreatedAtTrait { - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups(['dates'])] #[Gedmo\Timestampable(on: 'create')] - protected ?\DateTimeInterface $createdAt = null; + protected ?\DateTimeImmutable $createdAt = null; - public function getCreatedAt(): ?\DateTimeInterface + public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } diff --git a/databox/api/src/Entity/Traits/DeletedAtTrait.php b/databox/api/src/Entity/Traits/DeletedAtTrait.php index 97eb0e285..d5d2ca287 100644 --- a/databox/api/src/Entity/Traits/DeletedAtTrait.php +++ b/databox/api/src/Entity/Traits/DeletedAtTrait.php @@ -4,19 +4,20 @@ namespace App\Entity\Traits; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; trait DeletedAtTrait { - #[ORM\Column(type: 'datetime', nullable: true)] - private ?\DateTimeInterface $deletedAt = null; + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] + private ?\DateTimeImmutable $deletedAt = null; - public function getDeletedAt(): ?\DateTimeInterface + public function getDeletedAt(): ?\DateTimeImmutable { return $this->deletedAt; } - public function setDeletedAt(?\DateTimeInterface $deletedAt): void + public function setDeletedAt(?\DateTimeImmutable $deletedAt): void { $this->deletedAt = $deletedAt; } diff --git a/databox/api/src/Entity/Traits/LocaleTrait.php b/databox/api/src/Entity/Traits/LocaleTrait.php index 91795e552..ba2f58bd8 100644 --- a/databox/api/src/Entity/Traits/LocaleTrait.php +++ b/databox/api/src/Entity/Traits/LocaleTrait.php @@ -4,11 +4,12 @@ namespace App\Entity\Traits; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; trait LocaleTrait { - #[ORM\Column(type: 'string', length: 10, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 10, nullable: false)] private ?string $locale = null; public function getLocale(): string diff --git a/databox/api/src/Entity/Traits/UpdatedAtTrait.php b/databox/api/src/Entity/Traits/UpdatedAtTrait.php index 2bb339151..dfebd3def 100644 --- a/databox/api/src/Entity/Traits/UpdatedAtTrait.php +++ b/databox/api/src/Entity/Traits/UpdatedAtTrait.php @@ -4,16 +4,17 @@ namespace App\Entity\Traits; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; trait UpdatedAtTrait { - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Gedmo\Timestampable(on: 'update')] - private ?\DateTimeInterface $updatedAt = null; + private ?\DateTimeImmutable $updatedAt = null; - public function getUpdatedAt(): ?\DateTimeInterface + public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; } diff --git a/databox/api/src/Entity/Traits/WorkspacePrivacyTrait.php b/databox/api/src/Entity/Traits/WorkspacePrivacyTrait.php index 3b80bb015..5a7446ed2 100644 --- a/databox/api/src/Entity/Traits/WorkspacePrivacyTrait.php +++ b/databox/api/src/Entity/Traits/WorkspacePrivacyTrait.php @@ -5,11 +5,12 @@ namespace App\Entity\Traits; use App\Entity\Core\WorkspaceItemPrivacyInterface; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; trait WorkspacePrivacyTrait { - #[ORM\Column(type: 'smallint', nullable: false)] + #[ORM\Column(type: Types::SMALLINT, nullable: false)] private int $privacy = WorkspaceItemPrivacyInterface::SECRET; public function getPrivacy(): int diff --git a/databox/api/src/Entity/Traits/WorkspaceTrait.php b/databox/api/src/Entity/Traits/WorkspaceTrait.php index 441218c6f..fec453179 100644 --- a/databox/api/src/Entity/Traits/WorkspaceTrait.php +++ b/databox/api/src/Entity/Traits/WorkspaceTrait.php @@ -5,6 +5,7 @@ namespace App\Entity\Traits; use App\Entity\Core\Workspace; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; trait WorkspaceTrait diff --git a/databox/api/src/Entity/Workflow/WorkflowState.php b/databox/api/src/Entity/Workflow/WorkflowState.php index 7f1f592a9..3524ce70b 100644 --- a/databox/api/src/Entity/Workflow/WorkflowState.php +++ b/databox/api/src/Entity/Workflow/WorkflowState.php @@ -18,6 +18,7 @@ use App\Entity\Core\Asset; use App\Workflow\Event\IncomingUploaderFileWorkflowEvent; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; #[ApiResource( @@ -44,7 +45,7 @@ class WorkflowState extends BaseWorkflowState { final public const INITIATOR_ID = 'initiatorId'; - #[ORM\Column(type: 'string', length: 36, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 36, nullable: true)] private ?string $initiatorId = null; #[ORM\ManyToOne(targetEntity: Asset::class)] diff --git a/expose/api/src/Entity/Asset.php b/expose/api/src/Entity/Asset.php index 4f249c490..e70a3fe5a 100644 --- a/expose/api/src/Entity/Asset.php +++ b/expose/api/src/Entity/Asset.php @@ -21,6 +21,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; @@ -289,43 +290,43 @@ class Asset implements MediaInterface, \Stringable #[ApiProperty(identifier: true)] #[Groups(['_', self::GROUP_READ, Publication::GROUP_READ])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] private UuidInterface $id; #[ApiProperty] #[Groups([Publication::GROUP_READ, self::GROUP_READ])] - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $assetId = null; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $path = null; #[Groups([self::GROUP_READ, Publication::GROUP_READ])] - #[ORM\Column(type: 'bigint', options: ['unsigned' => true])] + #[ORM\Column(type: Types::BIGINT, options: ['unsigned' => true])] private ?string $size = null; #[ApiProperty] - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] #[Groups([self::GROUP_READ, Publication::GROUP_READ])] private ?string $title = null; #[ApiProperty] - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups([self::GROUP_READ, Publication::GROUP_READ])] private ?string $description = null; #[ApiProperty(iris: ['http://schema.org/name'])] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups([self::GROUP_READ, Publication::GROUP_READ])] private ?string $originalName = null; #[ApiProperty] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups([self::GROUP_READ, Publication::GROUP_READ, Publication::GROUP_LIST])] private ?string $mimeType = null; #[ApiProperty] - #[ORM\Column(type: 'string', nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] #[Groups(['publication:admin:read'])] private ?string $ownerId = null; @@ -334,11 +335,11 @@ class Asset implements MediaInterface, \Stringable */ #[ApiProperty] #[Groups([Publication::GROUP_READ, self::GROUP_READ])] - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected ?string $slug = null; #[ApiProperty] - #[ORM\Column(type: 'smallint', options: ['default' => 0])] + #[ORM\Column(type: Types::SMALLINT, options: ['default' => 0])] protected int $position = 0; #[ORM\ManyToOne(targetEntity: Publication::class, inversedBy: 'assets')] @@ -360,7 +361,7 @@ class Asset implements MediaInterface, \Stringable * Location latitude. */ #[ApiProperty] - #[ORM\Column(type: 'float', nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] #[Groups([self::GROUP_READ, Publication::GROUP_READ])] private ?float $lat = null; @@ -368,12 +369,12 @@ class Asset implements MediaInterface, \Stringable * Location longitude. */ #[ApiProperty] - #[ORM\Column(type: 'float', nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] #[Groups([self::GROUP_READ, Publication::GROUP_READ])] private ?float $lng = null; #[ApiProperty] - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['asset:admin:read'])] private ?string $webVTT = null; @@ -385,7 +386,7 @@ class Asset implements MediaInterface, \Stringable * Location altitude. */ #[ApiProperty] - #[ORM\Column(type: 'float', nullable: true)] + #[ORM\Column(type: Types::FLOAT, nullable: true)] #[Groups([self::GROUP_READ, Publication::GROUP_READ])] private ?float $altitude = null; diff --git a/expose/api/src/Entity/DownloadRequest.php b/expose/api/src/Entity/DownloadRequest.php index eb0c39e96..241a4dd19 100644 --- a/expose/api/src/Entity/DownloadRequest.php +++ b/expose/api/src/Entity/DownloadRequest.php @@ -13,6 +13,7 @@ use App\Security\Voter\DownloadRequestVoter; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; @@ -34,14 +35,14 @@ class DownloadRequest #[ApiProperty(identifier: true)] #[Groups(['publication:index', 'publication:index', Publication::GROUP_READ, Asset::GROUP_READ])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] private UuidInterface $id; #[ApiProperty] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $email = null; - #[ORM\Column(type: 'string', length: 5, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 5, nullable: true)] protected ?string $locale = null; #[ApiProperty(openapiContext: ['$ref' => '#/definitions/Publication'])] diff --git a/expose/api/src/Entity/EnvVar.php b/expose/api/src/Entity/EnvVar.php index f1ed8c8d7..d32da848f 100644 --- a/expose/api/src/Entity/EnvVar.php +++ b/expose/api/src/Entity/EnvVar.php @@ -6,6 +6,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -15,13 +16,13 @@ class EnvVar * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] protected $id; - #[ORM\Column(type: 'string', unique: true)] + #[ORM\Column(type: Types::STRING, unique: true)] private string $name = ''; - #[ORM\Column(type: 'text')] + #[ORM\Column(type: Types::TEXT)] private string $value = ''; #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] diff --git a/expose/api/src/Entity/FailedEvent.php b/expose/api/src/Entity/FailedEvent.php index 471da6e42..f4289dd07 100644 --- a/expose/api/src/Entity/FailedEvent.php +++ b/expose/api/src/Entity/FailedEvent.php @@ -8,6 +8,7 @@ use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -17,7 +18,7 @@ class FailedEvent extends BaseFailedEvent * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; diff --git a/expose/api/src/Entity/Publication.php b/expose/api/src/Entity/Publication.php index 8b78a0847..6d5788563 100644 --- a/expose/api/src/Entity/Publication.php +++ b/expose/api/src/Entity/Publication.php @@ -28,6 +28,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Serializer\Annotation\MaxDepth; @@ -123,16 +124,16 @@ class Publication implements AclObjectInterface, \Stringable #[ApiProperty(identifier: true)] #[Groups(['_', self::GROUP_LIST, self::GROUP_READ, Asset::GROUP_READ])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] private string $id; #[ApiProperty] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups([self::GROUP_LIST, self::GROUP_READ])] private ?string $title = null; #[ApiProperty] - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups([self::GROUP_LIST, self::GROUP_READ])] private ?string $description = null; @@ -174,7 +175,7 @@ class Publication implements AclObjectInterface, \Stringable private ?string $archiveDownloadUrl = null; #[ApiProperty] - #[ORM\Column(type: 'string', nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] #[Groups([self::GROUP_ADMIN_READ])] private ?string $ownerId = null; @@ -231,7 +232,7 @@ class Publication implements AclObjectInterface, \Stringable */ #[ApiProperty] #[Groups(['_', self::GROUP_LIST, self::GROUP_READ, self::GROUP_READ])] - #[ORM\Column(type: 'string', length: 100, nullable: true, unique: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true, unique: true)] protected ?string $slug = null; #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] @@ -246,10 +247,10 @@ class Publication implements AclObjectInterface, \Stringable #[Groups([self::GROUP_READ, Asset::GROUP_READ])] private ?string $cssLink = null; - #[ORM\Column(type: 'string', length: 36, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 36, nullable: true)] private ?string $zippyId = null; - #[ORM\Column(type: 'string', length: 32, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 32, nullable: true)] private ?string $zippyHash = null; public function __construct() diff --git a/expose/api/src/Entity/PublicationConfig.php b/expose/api/src/Entity/PublicationConfig.php index ea0569ae9..763864c7c 100644 --- a/expose/api/src/Entity/PublicationConfig.php +++ b/expose/api/src/Entity/PublicationConfig.php @@ -21,12 +21,12 @@ class PublicationConfig implements MergeableValueObjectInterface final public const SECURITY_METHOD_PASSWORD = 'password'; final public const SECURITY_METHOD_AUTHENTICATION = 'authentication'; - #[ORM\Column(type: 'boolean', nullable: true)] + #[ORM\Column(type: Types::BOOLEAN, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private ?bool $enabled = null; - #[ORM\Column(type: 'boolean', nullable: true)] + #[ORM\Column(type: Types::BOOLEAN, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private ?bool $downloadViaEmail = null; @@ -34,7 +34,7 @@ class PublicationConfig implements MergeableValueObjectInterface /** * Download Terms URL must also be set. */ - #[ORM\Column(type: 'boolean', nullable: true)] + #[ORM\Column(type: Types::BOOLEAN, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private ?bool $includeDownloadTermsInZippy = null; @@ -42,34 +42,34 @@ class PublicationConfig implements MergeableValueObjectInterface /** * @var Url[]|array */ - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private array $urls = []; - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private ?string $copyrightText = null; - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private ?string $css = null; - #[ORM\Column(type: 'string', length: 20, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 20, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] private ?string $layout = null; - #[ORM\Column(type: 'string', length: 30, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 30, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] private ?string $theme = null; - #[ORM\Column(type: 'boolean', nullable: true)] + #[ORM\Column(type: Types::BOOLEAN, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] private ?bool $publiclyListed = null; - #[ORM\Column(type: 'boolean', nullable: true)] + #[ORM\Column(type: Types::BOOLEAN, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] private ?bool $downloadEnabled = null; @@ -94,7 +94,7 @@ class PublicationConfig implements MergeableValueObjectInterface /** * "password" or "authentication". */ - #[ORM\Column(type: 'string', length: 20, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 20, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private ?string $securityMethod = null; @@ -103,7 +103,7 @@ class PublicationConfig implements MergeableValueObjectInterface * If securityMethod="password", you must provide: * {"password":"$3cr3t!"}. */ - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] #[Groups(['profile:read', 'publication:admin:read'])] #[ApiProperty] private array $securityOptions = []; @@ -111,14 +111,14 @@ class PublicationConfig implements MergeableValueObjectInterface /** * @var MapOptions|array|null */ - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] private $mapOptions; /** * @var LayoutOptions|array|null */ - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] #[Groups(['profile:read', 'publication:admin:read'])] private $layoutOptions; diff --git a/expose/api/src/Entity/PublicationProfile.php b/expose/api/src/Entity/PublicationProfile.php index 6e45acad3..82d9cfd34 100644 --- a/expose/api/src/Entity/PublicationProfile.php +++ b/expose/api/src/Entity/PublicationProfile.php @@ -20,6 +20,7 @@ use Doctrine\Common\Collections\Collection; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Ramsey\Uuid\UuidInterface; use Symfony\Component\Serializer\Annotation\Groups; @@ -61,11 +62,11 @@ class PublicationProfile implements AclObjectInterface, \Stringable #[ApiProperty(identifier: true)] #[Groups([self::GROUP_LIST, self::GROUP_READ, Publication::GROUP_READ])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] private UuidInterface $id; #[ApiProperty] - #[ORM\Column(type: 'string', length: 150)] + #[ORM\Column(type: Types::STRING, length: 150)] #[Groups([self::GROUP_LIST, self::GROUP_READ, Publication::GROUP_READ])] private ?string $name = null; @@ -74,7 +75,7 @@ class PublicationProfile implements AclObjectInterface, \Stringable private PublicationConfig $config; #[ApiProperty] - #[ORM\Column(type: 'string', nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] #[Groups([self::GROUP_ADMIN_READ])] private ?string $ownerId = null; diff --git a/expose/api/src/Entity/SubDefinition.php b/expose/api/src/Entity/SubDefinition.php index 5ed234327..7dcacfca9 100644 --- a/expose/api/src/Entity/SubDefinition.php +++ b/expose/api/src/Entity/SubDefinition.php @@ -15,6 +15,7 @@ use App\Repository\SubDefinitionRepository; use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Symfony\Component\Serializer\Annotation\Groups; @@ -186,7 +187,7 @@ class SubDefinition implements MediaInterface #[ApiProperty(identifier: true)] #[Groups([Asset::GROUP_READ, Publication::GROUP_READ, self::GROUP_READ])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] protected $id; #[ORM\ManyToOne(targetEntity: Asset::class, inversedBy: 'subDefinitions')] @@ -195,18 +196,18 @@ class SubDefinition implements MediaInterface #[ApiProperty] #[Groups([Asset::GROUP_READ, Publication::GROUP_READ, self::GROUP_READ])] - #[ORM\Column(type: 'string', length: 30)] + #[ORM\Column(type: Types::STRING, length: 30)] private ?string $name = null; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $path = null; #[Groups([self::GROUP_READ, Publication::GROUP_READ, Asset::GROUP_READ])] - #[ORM\Column(type: 'bigint', options: ['unsigned' => true])] + #[ORM\Column(type: Types::BIGINT, options: ['unsigned' => true])] private ?string $size = null; #[ApiProperty] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups([self::GROUP_READ, Asset::GROUP_READ])] private ?string $mimeType = null; diff --git a/expose/api/src/Entity/TermsConfig.php b/expose/api/src/Entity/TermsConfig.php index 4bb3f1efe..5a14faa42 100644 --- a/expose/api/src/Entity/TermsConfig.php +++ b/expose/api/src/Entity/TermsConfig.php @@ -4,17 +4,18 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; #[ORM\Embeddable] class TermsConfig implements MergeableValueObjectInterface { - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['profile:read', Publication::GROUP_READ])] private ?string $text = null; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] #[Groups(['profile:read', Publication::GROUP_READ])] private ?string $url = null; diff --git a/expose/api/src/Entity/Traits/ClientAnnotationsTrait.php b/expose/api/src/Entity/Traits/ClientAnnotationsTrait.php index 51230bd71..6fafa3553 100644 --- a/expose/api/src/Entity/Traits/ClientAnnotationsTrait.php +++ b/expose/api/src/Entity/Traits/ClientAnnotationsTrait.php @@ -5,6 +5,7 @@ namespace App\Entity\Traits; use ApiPlatform\Core\Annotation\ApiProperty; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -13,7 +14,7 @@ */ trait ClientAnnotationsTrait { - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['publication:admin:read', 'asset:admin:read', 'profile:admin:read'])] #[ApiProperty] private ?string $clientAnnotations = null; diff --git a/lib/js/react-ps/src/lib/oauth-client.ts b/lib/js/react-ps/src/lib/oauth-client.ts index ab8b60845..80c579097 100644 --- a/lib/js/react-ps/src/lib/oauth-client.ts +++ b/lib/js/react-ps/src/lib/oauth-client.ts @@ -66,6 +66,7 @@ export default class OAuthClient { private baseUrl: string; private storage: IStorage; private tokensCache: TokenResponse | undefined; + public tokenPromise: Promise | undefined; constructor({ clientId, @@ -293,7 +294,19 @@ export function configureClientAuthentication(client: AxiosInstance, oauthClient } if (!oauthClient.isAccessTokenValid()) { - await oauthClient.refreshToken(); + let p = oauthClient.tokenPromise; + if (p) { + await p; + } else { + const p = oauthClient.refreshToken(); + oauthClient.tokenPromise = p; + + try { + await p; + } finally { + oauthClient.tokenPromise = undefined; + } + } } config.headers ??= {}; diff --git a/lib/php/core-bundle/Entity/AbstractUuidEntity.php b/lib/php/core-bundle/Entity/AbstractUuidEntity.php index 1b5e3f67d..ac1b935cd 100644 --- a/lib/php/core-bundle/Entity/AbstractUuidEntity.php +++ b/lib/php/core-bundle/Entity/AbstractUuidEntity.php @@ -5,7 +5,9 @@ namespace Alchemy\CoreBundle\Entity; use ApiPlatform\Core\Annotation\ApiProperty; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Symfony\Component\Serializer\Annotation\Groups; @@ -14,7 +16,7 @@ abstract class AbstractUuidEntity { #[Groups(['_'])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ApiProperty(identifier: true)] private string $id; diff --git a/lib/php/storage-bundle/Entity/MultipartUpload.php b/lib/php/storage-bundle/Entity/MultipartUpload.php index 1388136f1..8933a32ff 100644 --- a/lib/php/storage-bundle/Entity/MultipartUpload.php +++ b/lib/php/storage-bundle/Entity/MultipartUpload.php @@ -11,7 +11,9 @@ use ApiPlatform\Metadata\Get; use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Symfony\Component\Serializer\Annotation\Groups; @@ -76,15 +78,15 @@ class MultipartUpload { #[Groups(['upload:read'])] #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ApiProperty(identifier: true)] private string $id; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups(['upload:read', 'upload:write'])] private ?string $filename = null; - #[ORM\Column(type: 'string', length: 150)] + #[ORM\Column(type: Types::STRING, length: 150)] #[Groups(['upload:read', 'upload:write'])] private ?string $type = null; @@ -92,22 +94,22 @@ class MultipartUpload private ?string $sizeAsString = null; #[ApiProperty(writable: false)] - #[ORM\Column(type: 'string', length: 150)] + #[ORM\Column(type: Types::STRING, length: 150)] private string $uploadId; #[ApiProperty(writable: false)] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $path = null; #[ApiProperty(writable: false)] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[Groups(['upload:read'])] private bool $complete = false; #[ApiProperty(writable: false)] - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups(['upload:read'])] - private ?\DateTimeInterface $createdAt = null; + private ?\DateTimeImmutable $createdAt = null; public function __construct() { @@ -150,7 +152,7 @@ public function setUploadId(string $uploadId): void $this->uploadId = $uploadId; } - public function getCreatedAt(): \DateTimeInterface + public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } diff --git a/lib/php/webhook-bundle/Entity/Webhook.php b/lib/php/webhook-bundle/Entity/Webhook.php index fc8bfab04..e05e1e04a 100644 --- a/lib/php/webhook-bundle/Entity/Webhook.php +++ b/lib/php/webhook-bundle/Entity/Webhook.php @@ -4,8 +4,10 @@ namespace Alchemy\WebhookBundle\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -17,34 +19,34 @@ class Webhook * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; - #[ORM\Column(type: 'string', length: 1024, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 1024, nullable: false)] private ?string $url = null; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] private ?string $secret = null; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $verifySSL = true; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] private bool $active = true; /** * Null if all events are active. */ - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] private ?array $events = null; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $options = []; - #[ORM\Column(type: 'datetime', nullable: false)] - private readonly \DateTimeInterface $createdAt; + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)] + private readonly \DateTimeImmutable $createdAt; public function __construct() { @@ -56,7 +58,7 @@ public function getId() return $this->id->__toString(); } - public function getCreatedAt(): \DateTimeInterface + public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } diff --git a/lib/php/webhook-bundle/Entity/WebhookLog.php b/lib/php/webhook-bundle/Entity/WebhookLog.php index 502f82cd5..41cefdb20 100644 --- a/lib/php/webhook-bundle/Entity/WebhookLog.php +++ b/lib/php/webhook-bundle/Entity/WebhookLog.php @@ -4,8 +4,10 @@ namespace Alchemy\WebhookBundle\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -15,7 +17,7 @@ class WebhookLog * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; @@ -24,17 +26,17 @@ class WebhookLog #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] private ?Webhook $webhook = null; - #[ORM\Column(type: 'string', length: 255, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] private ?string $event = null; - #[ORM\Column(type: 'json', nullable: false)] + #[ORM\Column(type: Types::JSON, nullable: false)] private array $payload = []; - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] private ?string $response = null; - #[ORM\Column(type: 'datetime', nullable: false)] - private readonly \DateTimeInterface $createdAt; + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)] + private readonly \DateTimeImmutable $createdAt; public function __construct() { @@ -46,7 +48,7 @@ public function getId() return $this->id->__toString(); } - public function getCreatedAt(): \DateTimeInterface + public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } diff --git a/lib/php/workflow/src/Doctrine/Entity/JobState.php b/lib/php/workflow/src/Doctrine/Entity/JobState.php index fe02551e6..51a1772a5 100644 --- a/lib/php/workflow/src/Doctrine/Entity/JobState.php +++ b/lib/php/workflow/src/Doctrine/Entity/JobState.php @@ -7,6 +7,7 @@ use Alchemy\Workflow\State\JobState as ModelJobState; use Alchemy\Workflow\State\StateUtil; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Uuid; @@ -18,13 +19,13 @@ class JobState protected int $status; - #[ORM\Column(type: 'date_immutable', nullable: false)] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: false)] protected \DateTimeImmutable $triggeredAt; - #[ORM\Column(type: 'date_immutable', nullable: true)] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] protected ?\DateTimeImmutable $startedAt = null; - #[ORM\Column(type: 'date_immutable', nullable: true)] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] protected ?\DateTimeImmutable $endedAt = null; protected ?ModelJobState $jobState = null; diff --git a/notify/api/src/Entity/Contact.php b/notify/api/src/Entity/Contact.php index 82dfedf7a..96a62fefe 100644 --- a/notify/api/src/Entity/Contact.php +++ b/notify/api/src/Entity/Contact.php @@ -4,8 +4,10 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -15,7 +17,7 @@ class Contact implements \Stringable * @var string */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; @@ -23,28 +25,28 @@ class Contact implements \Stringable /** * @var string */ - #[ORM\Column(type: 'string', length: 128, unique: true, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 128, unique: true, nullable: true)] protected $userId; /** * @var string|null */ - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] protected $email; /** * @var string|null */ - #[ORM\Column(type: 'string', length: 20, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 20, nullable: true)] protected $phone; /** * @var string|null */ - #[ORM\Column(type: 'string', length: 5, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 5, nullable: true)] protected $locale; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private readonly \DateTime $createdAt; public function __construct() diff --git a/notify/api/src/Entity/FailedEvent.php b/notify/api/src/Entity/FailedEvent.php index 8c40f816a..43b21d8b2 100644 --- a/notify/api/src/Entity/FailedEvent.php +++ b/notify/api/src/Entity/FailedEvent.php @@ -5,8 +5,10 @@ namespace App\Entity; use Arthem\Bundle\RabbitBundle\Model\FailedEvent as BaseFailedEvent; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -16,12 +18,12 @@ class FailedEvent extends BaseFailedEvent * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private ?\DateTime $createdAt = null; public function __construct() diff --git a/notify/api/src/Entity/TopicSubscriber.php b/notify/api/src/Entity/TopicSubscriber.php index 0903744f3..5dc075f4b 100644 --- a/notify/api/src/Entity/TopicSubscriber.php +++ b/notify/api/src/Entity/TopicSubscriber.php @@ -4,8 +4,10 @@ namespace App\Entity; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Table] @@ -17,19 +19,19 @@ class TopicSubscriber * @var string */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; - #[ORM\Column(type: 'string', length: 100, nullable: false)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: false)] protected ?string $topic = null; #[ORM\ManyToOne(targetEntity: Contact::class)] #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] protected ?Contact $contact = null; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private readonly \DateTime $createdAt; public function __construct() diff --git a/uploader/api/src/Entity/Asset.php b/uploader/api/src/Entity/Asset.php index 2289111b0..bb409289c 100644 --- a/uploader/api/src/Entity/Asset.php +++ b/uploader/api/src/Entity/Asset.php @@ -15,6 +15,7 @@ use App\Controller\AssetAckAction; use App\Controller\CreateAssetAction; use App\Security\Voter\AssetVoter; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; @@ -132,10 +133,10 @@ #[ORM\Entity(repositoryClass: AssetRepository::class)] class Asset extends AbstractUuidEntity { - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $path = null; - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] #[Groups('asset:read')] private ?array $data = []; @@ -147,16 +148,16 @@ class Asset extends AbstractUuidEntity private ?string $url = null; #[Groups('asset:read')] - #[ORM\Column(type: 'bigint', options: ['unsigned' => true])] + #[ORM\Column(type: Types::BIGINT, options: ['unsigned' => true])] private ?string $size = null; #[ApiProperty(iris: ['http://schema.org/name'])] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups('asset:read')] private ?string $originalName = null; #[ApiProperty] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups('asset:read')] private ?string $mimeType = null; @@ -167,17 +168,17 @@ class Asset extends AbstractUuidEntity #[ORM\ManyToOne(targetEntity: Commit::class, inversedBy: 'assets')] private ?Commit $commit = null; - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[Groups('asset:read')] #[ApiFilter(filterClass: BooleanFilter::class)] private bool $acknowledged = false; #[ApiProperty] - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups('asset:read')] private \DateTime $createdAt; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] private ?string $userId = null; public function __construct() diff --git a/uploader/api/src/Entity/Commit.php b/uploader/api/src/Entity/Commit.php index d3527c725..9ae240233 100644 --- a/uploader/api/src/Entity/Commit.php +++ b/uploader/api/src/Entity/Commit.php @@ -21,6 +21,7 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; use Doctrine\ORM\EntityManagerInterface; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -68,28 +69,28 @@ class Commit extends AbstractUuidEntity #[ApiProperty(writable: false)] #[Groups(['asset:read', 'commit:read'])] - #[ORM\Column(type: 'bigint', options: ['unsigned' => true])] + #[ORM\Column(type: Types::BIGINT, options: ['unsigned' => true])] private ?string $totalSize = null; - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] #[Groups(['asset:read', 'commit:read'])] private array $formData = []; #[Groups(['asset:read', 'commit:read', 'commit:write'])] - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] private array $options = []; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups(['asset:read', 'commit:read', 'commit:write'])] private ?string $userId = null; #[ApiProperty(writable: false)] - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Groups(['commit:read'])] private ?string $token = null; #[ApiProperty(writable: false)] - #[ORM\Column(type: 'boolean')] + #[ORM\Column(type: Types::BOOLEAN)] #[Groups(['asset:read', 'commit:read'])] #[ApiFilter(filterClass: BooleanFilter::class)] private bool $acknowledged = false; @@ -97,20 +98,20 @@ class Commit extends AbstractUuidEntity /** * If set, this email will be notified when asset consumer acknowledges the commit. */ - #[ORM\Column(type: 'string', nullable: true)] + #[ORM\Column(type: Types::STRING, nullable: true)] #[Groups(['commit:read', 'commit:write'])] private ?string $notifyEmail = null; - #[ORM\Column(type: 'string', length: 5, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 5, nullable: true)] #[Groups(['asset:read', 'commit:read', 'commit:write'])] private ?string $locale = null; - #[ORM\Column(type: 'datetime', nullable: true)] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE, nullable: true)] #[Groups(['asset:read', 'commit:read'])] private ?\DateTime $acknowledgedAt = null; #[ApiProperty] - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups(['asset:read', 'commit:read'])] private readonly \DateTime $createdAt; diff --git a/uploader/api/src/Entity/FailedEvent.php b/uploader/api/src/Entity/FailedEvent.php index adefd6cbc..8393eb4b1 100644 --- a/uploader/api/src/Entity/FailedEvent.php +++ b/uploader/api/src/Entity/FailedEvent.php @@ -5,8 +5,10 @@ namespace App\Entity; use Arthem\Bundle\RabbitBundle\Model\FailedEvent as BaseFailedEvent; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Ramsey\Uuid\Doctrine\UuidGenerator; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; #[ORM\Entity] @@ -16,12 +18,12 @@ class FailedEvent extends BaseFailedEvent * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[ORM\GeneratedValue(strategy: 'CUSTOM')] #[ORM\CustomIdGenerator(class: UuidGenerator::class)] protected $id; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] private ?\DateTime $createdAt = null; public function __construct() diff --git a/uploader/api/src/Entity/FormSchema.php b/uploader/api/src/Entity/FormSchema.php index c3b976357..e6a2b3ee0 100644 --- a/uploader/api/src/Entity/FormSchema.php +++ b/uploader/api/src/Entity/FormSchema.php @@ -13,6 +13,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use App\Controller\GetTargetFormSchemaAction; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; use Symfony\Component\Serializer\Annotation\Groups; @@ -51,22 +52,22 @@ class FormSchema extends AbstractUuidEntity implements AclObjectInterface #[Groups(['formschema:index', 'formschema:write'])] private ?Target $target = null; - #[ORM\Column(type: 'string', length: 5, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 5, nullable: true)] #[Groups(['formschema:index', 'formschema:write'])] private ?string $locale = null; - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] #[Groups(['formschema:index', 'formschema:write'])] private array $data = []; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups(['targetparams:index'])] #[Gedmo\Timestampable(on: 'create')] - private ?\DateTimeInterface $createdAt = null; + private ?\DateTimeImmutable $createdAt = null; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Gedmo\Timestampable(on: 'update')] - private ?\DateTimeInterface $updatedAt = null; + private ?\DateTimeImmutable $updatedAt = null; public function __construct(string $id = null) { @@ -111,12 +112,12 @@ public function setData(array $data): void $this->data = $data; } - public function getCreatedAt(): \DateTimeInterface + public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } - public function getUpdatedAt(): \DateTimeInterface + public function getUpdatedAt(): \DateTimeImmutable { return $this->updatedAt; } diff --git a/uploader/api/src/Entity/Target.php b/uploader/api/src/Entity/Target.php index 6c29c97a0..590eda17b 100644 --- a/uploader/api/src/Entity/Target.php +++ b/uploader/api/src/Entity/Target.php @@ -13,6 +13,7 @@ use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; use App\DataProvider\TargetDataProvider; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -42,41 +43,41 @@ class Target extends AbstractUuidEntity implements \Stringable { #[Groups(['target:index'])] #[Assert\Regex('/^[a-z][a-z0-9_-]+/')] - #[ORM\Column(type: 'string', length: 100, unique: true, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 100, unique: true, nullable: true)] protected ?string $slug = null; - #[ORM\Column(type: 'string', length: 1000)] + #[ORM\Column(type: Types::STRING, length: 1000)] #[Assert\Length(max: 1000)] #[Assert\NotBlank] #[Groups(['target:index'])] private ?string $name = null; - #[ORM\Column(type: 'boolean', nullable: false)] + #[ORM\Column(type: Types::BOOLEAN, nullable: false)] #[Groups(['target:read'])] private bool $enabled = true; - #[ORM\Column(type: 'text', nullable: true)] + #[ORM\Column(type: Types::TEXT, nullable: true)] #[Groups(['target:index'])] private ?string $description = null; - #[ORM\Column(type: 'string', length: 255)] + #[ORM\Column(type: Types::STRING, length: 255)] #[Assert\Length(max: 255)] #[Assert\Url] #[Assert\NotBlank] #[Groups(['target:write'])] private ?string $targetUrl = null; - #[ORM\Column(type: 'string', length: 255, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] #[Assert\Length(max: 255)] #[Groups(['target:write'])] private ?string $defaultDestination = null; - #[ORM\Column(type: 'string', length: 2000, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 2000, nullable: true)] #[Assert\Length(max: 2000)] #[Groups(['target:write'])] private ?string $targetAccessToken = null; - #[ORM\Column(type: 'string', length: 100, nullable: true)] + #[ORM\Column(type: Types::STRING, length: 100, nullable: true)] #[Assert\Length(max: 100)] #[Groups(['target:write'])] private ?string $targetTokenType = null; @@ -84,13 +85,13 @@ class Target extends AbstractUuidEntity implements \Stringable /** * Null value allows everyone. */ - #[ORM\Column(type: 'json', nullable: true)] + #[ORM\Column(type: Types::JSON, nullable: true)] #[Groups(['target:write'])] private ?array $allowedGroups = null; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups(['target:index'])] - private readonly \DateTimeInterface $createdAt; + private readonly \DateTimeImmutable $createdAt; #[ORM\OneToOne(mappedBy: 'target', targetEntity: TargetParams::class)] private ?TargetParams $targetParams = null; diff --git a/uploader/api/src/Entity/TargetParams.php b/uploader/api/src/Entity/TargetParams.php index 44c008f2a..9ff087cf8 100644 --- a/uploader/api/src/Entity/TargetParams.php +++ b/uploader/api/src/Entity/TargetParams.php @@ -13,8 +13,10 @@ use ApiPlatform\Metadata\GetCollection; use ApiPlatform\Metadata\Post; use ApiPlatform\Metadata\Put; +use Doctrine\DBAL\Types\Types; use Doctrine\ORM\Mapping as ORM; use Gedmo\Mapping\Annotation as Gedmo; +use Ramsey\Uuid\Doctrine\UuidType; use Ramsey\Uuid\Uuid; use Symfony\Component\Serializer\Annotation\Groups; use Symfony\Component\Validator\Constraints as Assert; @@ -42,7 +44,7 @@ class TargetParams implements AclObjectInterface * @var Uuid */ #[ORM\Id] - #[ORM\Column(type: 'uuid', unique: true)] + #[ORM\Column(type: UuidType::NAME, unique: true)] #[Groups(['targetparams:index'])] protected $id; @@ -53,18 +55,18 @@ class TargetParams implements AclObjectInterface #[ApiFilter(filterClass: SearchFilter::class, strategy: 'exact')] private ?Target $target = null; - #[ORM\Column(type: 'json')] + #[ORM\Column(type: Types::JSON)] #[Groups(['targetparams:index', 'targetparams:write'])] private array $data = []; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Groups(['targetparams:index'])] #[Gedmo\Timestampable(on: 'create')] - private ?\DateTimeInterface $createdAt = null; + private ?\DateTimeImmutable $createdAt = null; - #[ORM\Column(type: 'datetime')] + #[ORM\Column(type: Types::DATETIME_IMMUTABLE)] #[Gedmo\Timestampable(on: 'update')] - private ?\DateTimeInterface $updatedAt = null; + private ?\DateTimeImmutable $updatedAt = null; public function __construct() { @@ -113,12 +115,12 @@ public function setTarget(Target $target): void $this->target = $target; } - public function getCreatedAt(): ?\DateTimeInterface + public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } - public function getUpdatedAt(): ?\DateTimeInterface + public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; }