How to change Default Presenter

Bill Lions
Member | 47
+
0
-

Previously, I could set my default presenter with

public static function createRouter(): RouteList
{
        $router = new RouteList;
        $router->addRoute('/', 'Default:default');
        return $router;
}

The directory structure is different in my application and is:
app/DefaultModule/presenters/DefaultPresenter.php

Now, there is an entry in vendor/composer/autoload_classmap.php which reads:

‘App\\Presenters\\HomepagePresenter’ ⇒ $baseDir . ‘/app/Presenters/HomepagePresenter.php’,

This entry causes the application to seek out the HomepagePresenter, which no longer exists, and produces the error:

Warning
include(/var/www/html/vendor/composer/../../app/Presenters/HomepagePresenter.php): failed to open stream: No such file or directory

Removing the HomepagePresenter from vender/composer/autoload_classmap.php fixes the problem, but I am sure this is not the intended usage.

Is there some new nette 3.* way of overriding this?

CZechBoY
Member | 3608
+
0
-

After you add/remove some php file, you should run
composer dump-autoload
if you use Composer autoloader.

Bill Lions
Member | 47
+
0
-

CZechBoY wrote:

After you add/remove some php file, you should run
composer dump-autoload
if you use Composer autoloader.

I am not using composer.

CZechBoY
Member | 3608
+
0
-

Then its impossible to have this in composer’s autoloader :)

Bill Lions
Member | 47
+
-4
-

CZechBoY wrote:

Then its impossible to have this in composer’s autoloader :)

Not impossible, just has to be manually edited.
Unsure why these need to be in composer, and not in the router.
Same applies to Error4×xPresenter and ErrorPresenter.

Composer is not used in many of our government applications due to security issues.

Anywho, I just add it to my patch script, which modifies nette into supporting stand-alone modules, and it's done.
$ php nette –patch
Patch successful

Last edited by Bill Lions (2020-07-15 10:24)

CZechBoY
Member | 3608
+
0
-

Why is Composer not used in government applications? If you know about security issues, you should report them to Composer maintainers.

Please read something about autoloading here in php documentation: https://www.php.net/…autoload.php

Bill Lions
Member | 47
+
0
-

CZechBoY wrote:

Why is Composer not used in government applications? If you know about security issues, you should report them to Composer maintainers.

Please read something about autoloading here in php documentation: https://www.php.net/…autoload.php

Not my call, just that many IT departments do not like to hand over control of source to third parties.
Not really an imminent threat, simply increased risk, which CTO's do not wish to mitigate.

CZechBoY
Member | 3608
+
0
-

Ok, but pls dont use Nette because its open source and anybody can easily discover security holes.