-
-
Notifications
You must be signed in to change notification settings - Fork 113
PresenterFactory as callback & changed invalid link handling [WIP] #66
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
Conversation
src/Application/PresenterFactory.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of people are inheriting the class and this might make an unnecesary BC Break. It would be imho better to add sane default value to the property and create setter, just like @klimesf had it.
99a6ccb to
1efbc92
Compare
fba832b to
a2ca4e9
Compare
|
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typehint for $container?
What does $touchToRebuild mean? What should be the value? A comment would be nice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added typehint.
1503fcc to
fc4e514
Compare
PresenterFactory:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the closure, but I don't like that it's static class, when it doesn't have to be static class.
you could have created
class PresenterFactoryCallback
{
public function __construct(/* deps */);
public function __invoke($class);
}and attach it like
$presenterFactory = $container->addDefinition($this->prefix('presenterFactory'))
->setFactory('Nette\Application\PresenterFactory', [
new Nette\DI\Statement('Nette\Bridges\ApplicationDI\PresenterFactoryCallback')
])IMHO a lot nicer, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is fine. I take this more as a cosmetic detail, which can be changed at any time.
|
@hrach I see no changes in invalid link handling in first commit. This can be of course postponed to 2.4, but it seems to me unnecessary to wait a year before invalid links will throw warnings. ad design: to create interface & its implementation where can be used simple callback is possible, but over complicated. |
|
I'm 👍 for warnings on invalid links. They don't kill production and I wanna know about them. |
|
@dg sorry, I missread.
That's more Filip's proposal than mine. I see no reason to create another interface, when one is present. It's IPresenterFactory. It's totally ok to have one imlementaion dependent on DIC: |
I agree, the motivation was to get rid of changes in constructor, #66 (comment) |
1981bdd to
2772c8d
Compare
…nterFactoryCallback (BC break)
- triggers warnings on production - warning on development are configurable via 'silentLinks'
PresenterFactory as callback & changed invalid link handling [WIP]
Two different things.
INVALID_LINK_SILENT