Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1713 - Switch slugify to symfony string #1718

Draft
wants to merge 1 commit into
base: 4.x
Choose a base branch
from

Conversation

eerison
Copy link
Contributor

@eerison eerison commented Oct 11, 2023

Replace slugify to symfony string

Closes #1713.

Changelog

### Added
- Handle slugs using `Symfony string`

### Deprecated
- Deprecated `slugify` in favor of symfony string

@eerison eerison force-pushed the feature/1713_switch-slugfy-to-symfony-string branch from 1325fce to 7c87149 Compare December 1, 2023 16:58
@eerison eerison force-pushed the feature/1713_switch-slugfy-to-symfony-string branch 3 times, most recently from 56dcb0a to dd239c4 Compare January 3, 2024 14:53
@eerison eerison marked this pull request as ready for review January 3, 2024 14:57
- Refactored fixUrl method and created more unit tests.

Issue sonata-project#1713
@eerison eerison force-pushed the feature/1713_switch-slugfy-to-symfony-string branch from dd239c4 to 708060f Compare January 3, 2024 14:59
@eerison eerison changed the title Feature/1713 - Switch slugify for symfony string Feature/1713 - Switch slugify to symfony string Jan 3, 2024
Copy link
Member

@VincentLanglet VincentLanglet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this last change we should be good. Thanks

@@ -35,7 +37,7 @@ final class PageManager extends BaseEntityManager implements PageManagerInterfac
public function __construct(
string $class,
ManagerRegistry $registry,
private SlugifyInterface $slugify,
private SlugifyInterface|SluggerInterface $slugger,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to add a deprecation if the slugger passed is not instance of SluggerInterface.

And a next major comment to reduce the param to sluggerInterface.

$slug = $page->getSlug();

// NEXT_MAJOR: Remove Slugify support
if (null === $slug && $this->slugger instanceof Slugify) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (null === $slug && $this->slugger instanceof Slugify) {
if (null === $slug && $this->slugger instanceof SlugifyInterface) {

no?

and might be better to write

Suggested change
if (null === $slug && $this->slugger instanceof Slugify) {
if (null === $slug && !$this->slugger instanceof SluggerInterface) {

if (null === $slug && $this->slugger instanceof Slugify) {
@trigger_error(sprintf(
'%s is deprecated since version 4.8.0 and will be removed in 5.0, use %s instead of.',
Slugify::class,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Slugify::class,
SlugifyInterface::class,

@eerison eerison marked this pull request as draft January 30, 2024 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Switch cocur/slugify to symfony/string
2 participants