LinkGenerator: accept classname in $dest#296
Draft
mabar wants to merge 22 commits intonette:masterfrom
Draft
Conversation
Member
|
There should be a condition that always makes it clear whether it is a class or a presenter, otherwise it could get awkward. For example, a class must contain at least one character |
Contributor
Author
|
I wrote an regex which expects |
Contributor
Author
|
Okay, got it. Had to add some character classes. Seems like regex101 does not use php, just PCRE2 - regex with |
cb29fc4 to
ef31716
Compare
3463b9a to
ee24f8e
Compare
ddf16b5 to
87e4597
Compare
c62f26c to
e72b735
Compare
f536135 to
4e8f41d
Compare
c478b71 to
44181e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is minimal change needed in Nette in order to support NOT using mapping and to reference class directly instead.
To fully support that behavior also a
class_exists()check is needed inPresenterFactory. Without this is my change untestable, so let me know if I should modify alsoPresenterFactoryand write tests.https://github.com/orisai/nette-application/blob/73906f0f3009f751c15d8170467246957ca2e239/src/Mapping/DefaultPresenterFactory.php#L147-L163
I am already able to achieve it with
$this->presenter->link($this->presenter::class . ':default');.Benefit of this change is presenters don't have to follow any namespace structure, just like any class.