#[Package('core')]
trait EnsureThumbnailSizesTrait
{ /**
* @param list<array{width: int, height: int}> $thumbnailSizes
*
* @return string[]
*/
final protected function ensureThumbnailSizes(array
$thumbnailSizes, Connection
$connection): array
{ /** @var list<array{id: string, width: string, height: string}> $allSizes */
$allSizes =
$connection->
fetchAllAssociative( 'SELECT `id`, `width`, `height` FROM `media_thumbnail_size`'
);
$insertStatement =
$connection->
prepare('
INSERT INTO `media_thumbnail_size` (`id`, `width`, `height`, created_at)
VALUES (:id, :width, :height, :createdAt)
'
);
$sizes =
[];
foreach ($thumbnailSizes as $thumbnailSize) { $result =
array_filter($allSizes,
function D
$var) use ($thumbnailSize) {