Skip to content

Commit

Permalink
4.8.1 (#971)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Aug 26, 2024
1 parent b9bf0ce commit 45aa1d9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 19 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [4.8.1](https://github.com/sonata-project/SonataClassificationBundle/compare/4.8.0...4.8.1) - 2024-08-26
### Fixed
- [[#968](https://github.com/sonata-project/SonataClassificationBundle/pull/968)] Symfony 7.1 deprecation about `Symfony\Component\HttpKernel\DependencyInjection\Extension` usage ([@VincentLanglet](https://github.com/VincentLanglet))

## [4.8.0](https://github.com/sonata-project/SonataClassificationBundle/compare/4.7.2...4.8.0) - 2023-12-14
### Added
- [[#952](https://github.com/sonata-project/SonataClassificationBundle/pull/952)] Support for packages from `symfony/*` 7.x ([@phansys](https://github.com/phansys))
Expand Down
6 changes: 3 additions & 3 deletions src/Admin/Filter/CategoryFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function filter(ProxyQueryInterface $query, string $alias, string $field,

$query
->getQueryBuilder()
->andWhere(sprintf('%s.%s = :category', $alias, $field))
->andWhere(\sprintf('%s.%s = :category', $alias, $field))
->setParameter('category', $data->getValue());

$this->setActive(true);
Expand Down Expand Up @@ -101,7 +101,7 @@ private function getChoices(): array

\assert(null !== $catContext);

$choices[sprintf('%s (%s)', $category->getName() ?? '', $catContext->getId() ?? '')] = $category->getId();
$choices[\sprintf('%s (%s)', $category->getName() ?? '', $catContext->getId() ?? '')] = $category->getId();

$this->visitChild($category, $choices);
}
Expand All @@ -119,7 +119,7 @@ private function visitChild(CategoryInterface $category, array &$choices, int $l
}

foreach ($category->getChildren() as $child) {
$choices[sprintf('%s %s', str_repeat('-', 1 * $level), $child->__toString())] = $child->getId();
$choices[\sprintf('%s %s', str_repeat('-', 1 * $level), $child->__toString())] = $child->getId();

$this->visitChild($child, $choices, $level + 1);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Admin/Filter/CollectionFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function filter(ProxyQueryInterface $query, string $alias, string $field,

$query
->getQueryBuilder()
->andWhere(sprintf('%s.%s = :collection', $alias, $field))
->andWhere(\sprintf('%s.%s = :collection', $alias, $field))
->setParameter('collection', $data->getValue());

$this->setActive(true);
Expand Down
6 changes: 3 additions & 3 deletions src/Command/FixContextCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$tagId = $tag->getId();
\assert(null !== $tagId);

$output->writeln(sprintf(' > attach default context to tag: %s (%s)', $tag->getSlug() ?? '', $tagId));
$output->writeln(\sprintf(' > attach default context to tag: %s (%s)', $tag->getSlug() ?? '', $tagId));
$tag->setContext($defaultContext);

$this->tagManager->save($tag);
Expand All @@ -81,7 +81,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$collectionId = $collection->getId();
\assert(null !== $collectionId);

$output->writeln(sprintf(' > attach default context to collection: %s (%s)', $collection->getSlug() ?? '', $collectionId));
$output->writeln(\sprintf(' > attach default context to collection: %s (%s)', $collection->getSlug() ?? '', $collectionId));
$collection->setContext($defaultContext);

$this->collectionManager->save($collection);
Expand All @@ -97,7 +97,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
$categoryId = $category->getId();
\assert(null !== $categoryId);

$output->writeln(sprintf(' > attach default context to collection: %s (%s)', $category->getSlug() ?? '', $categoryId));
$output->writeln(\sprintf(' > attach default context to collection: %s (%s)', $category->getSlug() ?? '', $categoryId));
$category->setContext($defaultContext);

$this->categoryManager->save($category);
Expand Down
10 changes: 5 additions & 5 deletions src/Document/CategoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public function getRootCategoryWithChildren(CategoryInterface $category): Catego
{
$context = $category->getContext();
if (null === $context) {
throw new \InvalidArgumentException(sprintf(
throw new \InvalidArgumentException(\sprintf(
'Context of category "%s" cannot be null.',
$category->getId() ?? ''
));
}

$contextId = $context->getId();
if (null === $contextId) {
throw new \InvalidArgumentException(sprintf(
throw new \InvalidArgumentException(\sprintf(
'Context of category "%s" must have an not null identifier.',
$category->getId() ?? ''
));
Expand All @@ -72,7 +72,7 @@ public function getRootCategoryWithChildren(CategoryInterface $category): Catego
}
}

throw new \InvalidArgumentException(sprintf('Category "%s" does not exist.', $category->getId() ?? ''));
throw new \InvalidArgumentException(\sprintf('Category "%s" does not exist.', $category->getId() ?? ''));
}

public function getRootCategoriesForContext(?ContextInterface $context = null): array
Expand All @@ -81,7 +81,7 @@ public function getRootCategoriesForContext(?ContextInterface $context = null):

$contextId = $context->getId();
if (null === $contextId) {
throw new \InvalidArgumentException(sprintf(
throw new \InvalidArgumentException(\sprintf(
'Context "%s" must have an not null identifier.',
$context->getName() ?? ''
));
Expand Down Expand Up @@ -110,7 +110,7 @@ public function getAllRootCategories(bool $loadChildren = true): array

foreach ($rootCategories as $category) {
if (null === $category->getContext()) {
throw new \LogicException(sprintf(
throw new \LogicException(\sprintf(
'Context of category "%s" cannot be null.',
$category->getId() ?? ''
));
Expand Down
10 changes: 5 additions & 5 deletions src/Entity/CategoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ public function getRootCategoryWithChildren(CategoryInterface $category): Catego
{
$context = $category->getContext();
if (null === $context) {
throw new \InvalidArgumentException(sprintf(
throw new \InvalidArgumentException(\sprintf(
'Context of category "%s" cannot be null.',
$category->getId() ?? ''
));
}

$contextId = $context->getId();
if (null === $contextId) {
throw new \InvalidArgumentException(sprintf(
throw new \InvalidArgumentException(\sprintf(
'Context of category "%s" must have an not null identifier.',
$category->getId() ?? ''
));
Expand All @@ -72,7 +72,7 @@ public function getRootCategoryWithChildren(CategoryInterface $category): Catego
}
}

throw new \InvalidArgumentException(sprintf('Category "%s" does not exist.', $category->getId() ?? ''));
throw new \InvalidArgumentException(\sprintf('Category "%s" does not exist.', $category->getId() ?? ''));
}

public function getRootCategoriesForContext(?ContextInterface $context = null): array
Expand All @@ -83,7 +83,7 @@ public function getRootCategoriesForContext(?ContextInterface $context = null):

$contextId = $context->getId();
if (null === $contextId) {
throw new \InvalidArgumentException(sprintf(
throw new \InvalidArgumentException(\sprintf(
'Context "%s" must have an not null identifier.',
$context->getName() ?? ''
));
Expand Down Expand Up @@ -111,7 +111,7 @@ public function getAllRootCategories(bool $loadChildren = true): array

foreach ($rootCategories as $category) {
if (null === $category->getContext()) {
throw new \LogicException(sprintf(
throw new \LogicException(\sprintf(
'Context of category "%s" cannot be null.',
$category->getId() ?? ''
));
Expand Down
4 changes: 2 additions & 2 deletions src/Form/Type/CategorySelectorType.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function getChoices(Options $options): array
$rootCategoryId = $rootCategory->getId();
\assert(null !== $context && null !== $rootCategoryId);

$choices[$rootCategoryId] = sprintf('%s (%s)', $rootCategory->getName() ?? '', $context->getId() ?? '');
$choices[$rootCategoryId] = \sprintf('%s (%s)', $rootCategory->getName() ?? '', $context->getId() ?? '');

$this->childWalker($rootCategory, $category, $choices);
}
Expand Down Expand Up @@ -110,7 +110,7 @@ private function childWalker(CategoryInterface $rootCategory, CategoryInterface
continue;
}

$choices[$childCategoryId] = sprintf('%s %s', str_repeat('-', 1 * $level), $childCategory->getName() ?? '');
$choices[$childCategoryId] = \sprintf('%s %s', str_repeat('-', 1 * $level), $childCategory->getName() ?? '');

$this->childWalker($childCategory, $category, $choices, $level + 1);
}
Expand Down

0 comments on commit 45aa1d9

Please sign in to comment.