Skip to content

Add new route implementation #7726

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

Merged
merged 19 commits into from
Mar 3, 2025

Conversation

alexander-schranz
Copy link
Member

@alexander-schranz alexander-schranz commented Jan 10, 2025

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? yes
Fixed tickets fixes #
Related issues/PRs see #7672
License MIT
Documentation PR sulu/sulu-docs#

What's in this PR?

Add new route implementation.

Why?

I did some experimenting to simplify the route handling in https://github.com/alexander-schranz/route-prototype. Instead of that the developer need manually care about updating things we will work with doctrine listeners which will update child urls automatically to avoid issues like:

Also we will not longer have a difference between unpublished or published URLs. Currently in Article Bundle I could create 2 articles with the url /test and /test and it did only error when try to publish one. This should not longer be the case as we already reserving and create a unique URL when saving the Entity and does not end in publishing errors specially when try using in combination with the AutomationBundle.

ToDo

  • Create Entity
  • Childs are update
  • Grand childs are update
  • Multi Localization support
  • Multi Site support
  • Support for non Site connected routes (article)
    • Site A with /test and Site B /test and article parent Site A /test/article should not be updated when Site B /test was changed

ToDos in own Pull Requests

@alexander-schranz alexander-schranz force-pushed the feature/route-handling branch 3 times, most recently from 766aa63 to fcfe31e Compare January 10, 2025 12:49
@alexander-schranz alexander-schranz added Feature New functionality not yet included in Sulu DX Affecting the end developer labels Jan 10, 2025
@alexander-schranz alexander-schranz force-pushed the feature/route-handling branch 6 times, most recently from 2fd552e to a72f63e Compare January 10, 2025 14:17
@@ -36,7 +36,7 @@
"doctrine/cache": "^1.12.1 || ^2.0",
"doctrine/collections": "^1.6 || ^2.0",
"doctrine/data-fixtures": "^1.4",
"doctrine/dbal": "^3.3",
"doctrine/dbal": "^3.6",
Copy link
Member Author

@alexander-schranz alexander-schranz Jan 10, 2025

Choose a reason for hiding this comment

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

Deprecated Connection::PARAM_*_ARRAY constants: Use the corresponding constants on ArrayParameterType instead.

So I also replaced it in AccessControlRepository

The 3.6 was released 2 years ago: https://github.com/doctrine/dbal/releases/3.6.0 so we are fine to upgrade.

@@ -87,7 +88,7 @@ public function findIdsWithGrantedPermissions(
->andWhere('accessControl.role IN (' . $systemRoleQueryBuilder->getDQL() . ')')
->setParameter('system', $system)
->setParameter('entityClass', $entityClass)
->setParameter('entityIds', $entityIds, Connection::PARAM_STR_ARRAY)
->setParameter('entityIds', $entityIds, ArrayParameterType::STRING)
Copy link
Member Author

Choose a reason for hiding this comment

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

DoctrineDBAL:

Deprecated Connection::PARAM_*_ARRAY constants: Use the corresponding constants on ArrayParameterType instead.


<field name="site" type="string" length="16" nullable="true"/>
<field name="locale" type="string" length="11"/>
<field name="slug" type="string"/>
Copy link
Member Author

Choose a reason for hiding this comment

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

To support or versions of mysql site + locale + slug can not be longer together as 191 chars. Which means in this case 191 - 16 -11 = 164 chars for the slug.

There would be one workaround to support longer versions of URL by using a additional slugHash field based on widely supported SHA1 algorithm. That way we can support longer Urls 164.

@benr77 already requested that the current title of 64 is to small for his usecases. If we increase that to 128 or 191. A longer parent title and a child page or 3 levels of navigation could already hit the 191 limit and we would require trim the url correctly. But that is more a theoretical issue. Which may already existed before.

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting the workaround with a Hash is also documented in MySQL docs itself but as a alternative for composite indexes so n our case it would include the site, locale, slug: https://dev.mysql.com/doc/refman/8.4/en/multiple-column-indexes.html

@alexander-schranz alexander-schranz marked this pull request as ready for review January 27, 2025 11:34
@alexander-schranz alexander-schranz added this to the Release 3.0 milestone Feb 13, 2025
Co-authored-by: Prokyonn <daniel.mathis@sector8.eu>
@alexander-schranz
Copy link
Member Author

8.4 error is unrelated to the PR. Looks like some issues in one of our dependencies maybe only a dev anomaly but we should test what is causing it symfony or the 2fa bundle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX Affecting the end developer Feature New functionality not yet included in Sulu
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants