diff --git a/CHANGELOG.md b/CHANGELOG.md index 75c42ccc..6b9d255e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [1.8.2](https://github.com/anzusystems/core-dam-bundle/compare/1.8.1...1.8.2) (2024-03-12) + +### Features +* Podcast episode extUrl, podcast extUrl +* 'avif' support + ## [1.8.1](https://github.com/anzusystems/core-dam-bundle/compare/1.8.0...1.8.1) (2024-02-29) ### Changes * Podcast rss url length validation diff --git a/src/App.php b/src/App.php index c22db0a7..936b491b 100644 --- a/src/App.php +++ b/src/App.php @@ -9,14 +9,15 @@ final class App extends AnzuApp { - public const ZERO = 0; - public const DOCTRINE_EXTRA_LAZY = 'EXTRA_LAZY'; - public const CACHE_STRATEGY = 'NONSTRICT_READ_WRITE'; - public const DATE_TIME_API_FORMAT = 'Y-m-d\TH:i:s.u\Z'; + public const int ZERO = 0; + public const string DOCTRINE_EXTRA_LAZY = 'EXTRA_LAZY'; + public const string CACHE_STRATEGY = 'NONSTRICT_READ_WRITE'; + public const string DATE_TIME_API_FORMAT = 'Y-m-d\TH:i:s.u\Z'; + public const string ORDER_ASC = 'ASC'; - public const ENTITY_NAMESPACE = __NAMESPACE__ . '\Entity'; + public const string ENTITY_NAMESPACE = __NAMESPACE__ . '\Entity'; - private const RANDOM_BYTES_LEN = 32; + private const int RANDOM_BYTES_LEN = 32; /** * @throws Exception diff --git a/src/Domain/Podcast/PodcastManager.php b/src/Domain/Podcast/PodcastManager.php index 10fbfafd..61cd956b 100644 --- a/src/Domain/Podcast/PodcastManager.php +++ b/src/Domain/Podcast/PodcastManager.php @@ -52,6 +52,7 @@ public function update(Podcast $podcast, Podcast $newPodcast, bool $flush = true ; $podcast->getAttributes() ->setRssUrl($newPodcast->getAttributes()->getRssUrl()) + ->setExtUrl($newPodcast->getAttributes()->getExtUrl()) ->setFileSlot($newPodcast->getAttributes()->getFileSlot()) ->setMode($newPodcast->getAttributes()->getMode()) ; diff --git a/src/Domain/PodcastEpisode/PodcastEpisodeManager.php b/src/Domain/PodcastEpisode/PodcastEpisodeManager.php index e7c55446..4a598815 100644 --- a/src/Domain/PodcastEpisode/PodcastEpisodeManager.php +++ b/src/Domain/PodcastEpisode/PodcastEpisodeManager.php @@ -61,6 +61,7 @@ public function update(PodcastEpisode $podcastEpisode, PodcastEpisode $newPodcas $podcastEpisode->getAttributes() ->setSeasonNumber($newPodcastEpisode->getAttributes()->getSeasonNumber()) ->setEpisodeNumber($newPodcastEpisode->getAttributes()->getEpisodeNumber()) + ->setExtUrl($newPodcastEpisode->getAttributes()->getExtUrl()) ; $podcastEpisode->getTexts() ->setTitle($newPodcastEpisode->getTexts()->getTitle()) diff --git a/src/Entity/AssetFile.php b/src/Entity/AssetFile.php index 6eed8cc8..77ab358e 100644 --- a/src/Entity/AssetFile.php +++ b/src/Entity/AssetFile.php @@ -48,7 +48,7 @@ abstract class AssetFile implements use NotifyToTrait; #[ORM\OneToMany(mappedBy: 'assetFile', targetEntity: Chunk::class, fetch: App::DOCTRINE_EXTRA_LAZY)] - #[ORM\OrderBy(value: ['offset' => Criteria::ASC])] + #[ORM\OrderBy(value: ['offset' => App::ORDER_ASC])] protected Collection $chunks; #[ORM\OneToOne(targetEntity: AssetFileMetadata::class)] diff --git a/src/Entity/CustomForm.php b/src/Entity/CustomForm.php index 9135a469..fbfa4cf2 100644 --- a/src/Entity/CustomForm.php +++ b/src/Entity/CustomForm.php @@ -9,6 +9,7 @@ use AnzuSystems\Contracts\Entity\Interfaces\UuidIdentifiableInterface; use AnzuSystems\Contracts\Entity\Traits\TimeTrackingTrait; use AnzuSystems\Contracts\Entity\Traits\UserTrackingTrait; +use AnzuSystems\CoreDamBundle\App; use AnzuSystems\CoreDamBundle\Entity\Traits\UuidIdentityTrait; use AnzuSystems\CoreDamBundle\Repository\CustomFormRepository; use Doctrine\Common\Collections\ArrayCollection; @@ -26,7 +27,7 @@ class CustomForm implements TimeTrackingInterface, UuidIdentifiableInterface, Us use UserTrackingTrait; #[ORM\OneToMany(mappedBy: 'form', targetEntity: CustomFormElement::class)] - #[ORM\OrderBy(value: ['position' => Criteria::ASC])] + #[ORM\OrderBy(value: ['position' => App::ORDER_ASC])] #[Assert\Valid] private Collection $elements; diff --git a/src/Entity/DistributionCategorySelect.php b/src/Entity/DistributionCategorySelect.php index c9f0b27a..87b21c4a 100644 --- a/src/Entity/DistributionCategorySelect.php +++ b/src/Entity/DistributionCategorySelect.php @@ -11,6 +11,7 @@ use AnzuSystems\Contracts\Entity\Interfaces\UuidIdentifiableInterface; use AnzuSystems\Contracts\Entity\Traits\TimeTrackingTrait; use AnzuSystems\Contracts\Entity\Traits\UserTrackingTrait; +use AnzuSystems\CoreDamBundle\App; use AnzuSystems\CoreDamBundle\Entity\Interfaces\ExtSystemInterface; use AnzuSystems\CoreDamBundle\Entity\Traits\UuidIdentityTrait; use AnzuSystems\CoreDamBundle\Model\Enum\AssetType; @@ -49,7 +50,7 @@ class DistributionCategorySelect implements TimeTrackingInterface, UserTrackingI #[Serialize(type: DistributionCategoryOption::class)] #[ORM\OneToMany(mappedBy: 'select', targetEntity: DistributionCategoryOption::class)] - #[ORM\OrderBy(['position' => Criteria::ASC])] + #[ORM\OrderBy(['position' => App::ORDER_ASC])] #[Assert\Count(min: 1, minMessage: ValidationException::ERROR_FIELD_LENGTH_MIN)] #[Assert\Valid] private Collection $options; diff --git a/src/Entity/Embeds/PodcastAttributes.php b/src/Entity/Embeds/PodcastAttributes.php index 304baaab..ef15a1da 100644 --- a/src/Entity/Embeds/PodcastAttributes.php +++ b/src/Entity/Embeds/PodcastAttributes.php @@ -15,12 +15,24 @@ #[ORM\Embeddable] class PodcastAttributes { + /** + * RSS feed URL + */ #[ORM\Column(type: Types::STRING, length: 2_048, nullable: true)] #[Assert\Length(max: 2_048, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)] #[Assert\Url(message: ValidationException::ERROR_FIELD_INVALID)] #[Serialize] private string $rssUrl; + /** + * Podcast URL (located in external service) + */ + #[ORM\Column(type: Types::STRING, length: 2_048, options: ['default' => ''])] + #[Assert\Length(max: 2_048, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)] + #[Assert\Url(message: ValidationException::ERROR_FIELD_INVALID)] + #[Serialize] + private string $extUrl; + #[ORM\Column(type: Types::STRING, length: 128, nullable: true)] #[Assert\Length(max: 128, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)] #[Serialize] @@ -37,6 +49,7 @@ public function __construct() { $this->setRssUrl(''); $this->setFileSlot(''); + $this->setExtUrl(''); $this->setLastImportStatus(PodcastLastImportStatus::Default); $this->setMode(PodcastImportMode::Default); } @@ -89,4 +102,15 @@ public function setFileSlot(string $fileSlot): self return $this; } + + public function getExtUrl(): string + { + return $this->extUrl; + } + + public function setExtUrl(string $extUrl): self + { + $this->extUrl = $extUrl; + return $this; + } } diff --git a/src/Entity/Embeds/PodcastEpisodeAttributes.php b/src/Entity/Embeds/PodcastEpisodeAttributes.php index 3f7d77d4..e9ca2736 100644 --- a/src/Entity/Embeds/PodcastEpisodeAttributes.php +++ b/src/Entity/Embeds/PodcastEpisodeAttributes.php @@ -14,9 +14,21 @@ #[ORM\Embeddable] class PodcastEpisodeAttributes { + /** + * Audio track URL provided by external service (obtained from RSS FEED) + */ #[ORM\Column(type: Types::STRING, length: 2_048)] private string $rssUrl; + /** + * Podcast episode URL (located in external service) + */ + #[ORM\Column(type: Types::STRING, length: 2_048, options: ['default' => ''])] + #[Assert\Length(max: 2_048, maxMessage: ValidationException::ERROR_FIELD_LENGTH_MAX)] + #[Assert\Url(message: ValidationException::ERROR_FIELD_INVALID)] + #[Serialize] + private string $extUrl; + #[ORM\Column(type: Types::STRING, length: 255)] private string $rssId; @@ -40,6 +52,7 @@ public function __construct() $this->setLastImportStatus(PodcastEpisodeStatus::Default); $this->setRssId(''); $this->setRssUrl(''); + $this->setExtUrl(''); } #[Serialize] @@ -104,4 +117,16 @@ public function setRssId(string $rssId): self return $this; } + + public function getExtUrl(): string + { + return $this->extUrl; + } + + public function setExtUrl(string $extUrl): self + { + $this->extUrl = $extUrl; + + return $this; + } } diff --git a/src/Entity/ImageFile.php b/src/Entity/ImageFile.php index 17e3a0ca..c47d54d3 100644 --- a/src/Entity/ImageFile.php +++ b/src/Entity/ImageFile.php @@ -20,7 +20,7 @@ class ImageFile extends AssetFile private ImageAttributes $imageAttributes; #[ORM\OneToMany(mappedBy: 'image', targetEntity: ImageFileOptimalResize::class)] - #[ORM\OrderBy(value: ['requestedSize' => Criteria::ASC])] + #[ORM\OrderBy(value: ['requestedSize' => App::ORDER_ASC])] private Collection $resizes; #[ORM\OneToMany(mappedBy: 'image', targetEntity: RegionOfInterest::class)] diff --git a/src/Model/Enum/ImageMimeTypes.php b/src/Model/Enum/ImageMimeTypes.php index b80a0ccc..146fe227 100644 --- a/src/Model/Enum/ImageMimeTypes.php +++ b/src/Model/Enum/ImageMimeTypes.php @@ -27,6 +27,5 @@ enum ImageMimeTypes: string implements EnumInterface case MimePng = self::MIME_PNG; case MimeWebp = self::MIME_WEBP; case MimeGif = self::MIME_GIF; - // todo fix colors -// case MimeAvif = self::MIME_AVIF; + case MimeAvif = self::MIME_AVIF; }