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

Remove Slugify Method #1506

Merged

Conversation

jordisala1991
Copy link
Member

@jordisala1991 jordisala1991 commented Jul 30, 2022

Subject

I am targeting this branch, because this is BC break.

Changelog

### Removed
- Remove `setSlugifyMethod` and `getSlugifyMethod` static methods from Page.

@jordisala1991 jordisala1991 marked this pull request as ready for review July 30, 2022 16:13
@jordisala1991
Copy link
Member Author

TBH I don't even know why is this needed. Since there is only that call to the setter, and the getter is never used (AFAIK). @eerison do you have another opinion?

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.

Phpstan is failing.
You need to update public static function slugify($text)

@jordisala1991
Copy link
Member Author

Yep, now I saw the usage... I will refactor code to not need any of this black magic

@eerison
Copy link
Contributor

eerison commented Jul 31, 2022

Hey @jordisala1991 I didn't check how it's done

But I know that we use the slugfy for pages, but if I remember correct we can't set, it's based on the page name 🤔

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.

We need a PR on 3.x with a BC way to use the new constructor signature of PageManager

@jordisala1991
Copy link
Member Author

I need some help for all those 3.x BC things... otherwise it will take ages to get there. In this case, the manager will be final on 4.x. Do we need to provide such a BC path?

@VincentLanglet
Copy link
Member

I need some help for all those 3.x BC things... otherwise it will take ages to get there. In this case, the manager will be final on 4.x. Do we need to provide such a BC path?

If someone call

new PageManager($class, $registry, $defaults, $pageDefaults);

on 4.x it will crash

So we need to do

public function __construct($class, ManagerRegistry $registry, Slugify|array $slugify = [], array $default = [], array $pageDefaults = []) 

on 3.x.
is_array($slugify) => deprecation message

@jordisala1991
Copy link
Member Author

I need some help for all those 3.x BC things... otherwise it will take ages to get there. In this case, the manager will be final on 4.x. Do we need to provide such a BC path?

If someone call

new PageManager($class, $registry, $defaults, $pageDefaults);

on 4.x it will crash

So we need to do

public function __construct($class, ManagerRegistry $registry, Slugify|array $slugify = [], array $default = [], array $pageDefaults = []) 

on 3.x. is_array($slugify) => deprecation message

Is not that easy, I will need to inject the variable, and try to use it. But we don't know how the user is calling the setSlugifyMethod on the page model. So at the end, all of it could be a bc break.

@VincentLanglet
Copy link
Member

Is not that easy, I will need to inject the variable, and try to use it. But we don't know how the user is calling the setSlugifyMethod on the page model. So at the end, all of it could be a bc break.

If it's too hard, we can accept the non-solvabel BC break to release 4.x faster then

@jordisala1991 jordisala1991 merged commit e7505e6 into sonata-project:4.x Jul 31, 2022
@jordisala1991 jordisala1991 deleted the hotfix/remove-slugify-method branch July 31, 2022 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants