Log message #4268260

# At Username Text
# Jul 24th 2021, 22:32 jojomartius mh... yes there must be something overwriting my config... usually computers don't lie ;-)
# Jul 24th 2021, 22:31 kevin.pfeifer you sure no other config overwrites your config set in app.php?
# Jul 24th 2021, 22:30 kevin.pfeifer basically the decision/logic for that is present in `vendor/cakephp/cakephp/src/Error/ErrorLogger.php` line 77 If you got xdebug maybe step into there
# Jul 24th 2021, 22:28 jojomartius `021-07-25 00:28:03 Error: [Cake\Http\Exception\MissingControllerException] Controller class Asdf could not be found. in /app/app/acb/vendor/cakephp/cakephp/src/Controller/ControllerFactory.php on line 226` Exception Attributes: array ( 'class' => 'Asdf', 'plugin' => NULL, 'prefix' => NULL, '_ext' => NULL, ) Request URL: /asdf Client IP: 172.19.0.1
# Jul 24th 2021, 22:28 jojomartius ``` 'Error' => [ 'errorLevel' => E_ALL and ~E_USER_DEPRECATED and ~E_USER_NOTICE, 'exceptionRenderer' => 'Cake\Error\ExceptionRenderer', 'skipLog' => ['Cake\Http\Exception\MissingControllerException'], 'log' => true, 'trace' => true, ],```
# Jul 24th 2021, 22:28 jojomartius intresting
# Jul 24th 2021, 22:27 kevin.pfeifer no error when adding ```'skipLog' => ['Cake\Http\Exception\MissingControllerException'],``` and calling an unkown URL
# Jul 24th 2021, 22:27 kevin.pfeifer mhmm, it works for me :thinking_face:
# Jul 24th 2021, 22:17 jojomartius Hey, i'm using Cakephp 4.2 and want to skip some error's from being logged (to much in production). I added in app.php Error.skipLog => ['Cake\Http\Exception\MissingControllerException'] but i still get messages when i try to visit random urls like /lkajsdf2 in logs/error.log. Did i get it wrong?
# Jul 24th 2021, 19:14 kevin.pfeifer as always, just ask ;)
# Jul 24th 2021, 18:21 kevin.pfeifer https://github.com/cakephp/app/blob/master/src/Controller/PagesController.php#L46
# Jul 24th 2021, 18:10 kevin.pfeifer just like in the main app example https://github.com/cakephp/app/blob/master/config/routes.php#L53 You can set the default homepage via ```$builder->connect('/', ['controller' => 'Pages', 'action' => 'display', 'home']);``` Which will show the `/templates/pages/home` template for your root domain like http://mydomain.local
# Jul 24th 2021, 17:56 kevin.pfeifer basically ```$this->set('navs', $navs);``` and ```$this->set(compact('navs'));``` are the same
# Jul 24th 2021, 17:50 kevin.pfeifer and see https://book.cakephp.org/3/en/controllers.html#setting-view-variables how `$this->set()` works with either 2 parameters or one associative array
# Jul 24th 2021, 17:47 kevin.pfeifer but basically its up to you if you want to build the query completely in the controller or clean up the controller and put these query statements in the model
# Jul 24th 2021, 17:47 kevin.pfeifer but if you want to use your custom finder method you should use ```  $navs = $this->Pages->find('publish')``` instead of ```  $navs = $this->Pages->find('all')```
# Jul 24th 2021, 17:46 kevin.pfeifer see https://www.php.net/manual/de/function.compact.php what compact does. It just is a neat way to transform variables inside the controller into key=>value pairs which then can be set to the view via `$this->set(compact('vars'));`
# Jul 24th 2021, 17:14 slackebot2 Controller => View
# Jul 24th 2021, 17:14 kevin.pfeifer there should be no calling of custom finder methods via the template directly. If you have already defined that function in your PagesTable.php then you should go to your PagesController.php, call that finder in e.g. the `index()` function via ```$data = $this->Pages->find('publish')->toArray();``` and set that data to be accessible in your view/template via ```$this->set(compact('data'));``` So always go Model =>
# Jul 24th 2021, 09:45 kevin.pfeifer there is only one post-install hook after `composer install` which sets `chmod -R 777 logs tmp` https://github.com/cakephp/app/blob/54b699c2b0b212cef645f8c764c6b7494c9bba32/src/Console/Installer.php#L136
# Jul 24th 2021, 09:35 kevin.pfeifer what permissions problems do you have?
# Jul 24th 2021, 09:10 noel I tried this:-https://book.cakephp.org/3/en/installation.html#permissions ... but it doesn't work on Mac
# Jul 24th 2021, 09:09 noel Is there a bin/cake command to reset folder permissions for cake?
# Jul 24th 2021, 08:25 rohith Never mind, I think I am supposed to do that using TypeFactory::map() function :)
# Jul 24th 2021, 08:20 rohith Hi, is there any way to disable date and time converting to FrozenDate Object when executing queries ?
# Jul 23rd 2021, 13:27 kevin.pfeifer but thats how the authentication and authorization plugin is built now
# Jul 23rd 2021, 13:27 kevin.pfeifer not that easy for sure
# Jul 23rd 2021, 13:27 paolo.bragagni thanks Kevin
# Jul 23rd 2021, 13:27 paolo.bragagni but probaby from now on I can go with my legs
# Jul 23rd 2021, 13:27 kevin.pfeifer then you need to adjust that in the given config
# Jul 23rd 2021, 13:26 paolo.bragagni and not to https://cakephp.local/myapp/users/login
# Jul 23rd 2021, 13:26 paolo.bragagni https://cakephp.local/users/login
# Jul 23rd 2021, 13:26 paolo.bragagni it redirects to
# Jul 23rd 2021, 13:26 kevin.pfeifer and the ```$request->getFlash()->error('You are not authorized to access that location');``` needs to be added anywhere in the handle function before the reutnr
# Jul 23rd 2021, 13:24 kevin.pfeifer and adjust the namespace to `namespace App\Middleware\UnauthorizedHandler;`
# Jul 23rd 2021, 13:24 kevin.pfeifer if you copied the whole RedirectHandler then you will have to add at least ```use Authorization\Middleware\UnauthorizedHandler\HandlerInterface;``` at the top since the interface can’t be autoloaded
# Jul 23rd 2021, 13:22 paolo.bragagni steps ahead
# Jul 23rd 2021, 13:20 kevin.pfeifer ok and ```use Authorization\Exception\ForbiddenException; ``` at the top
# Jul 23rd 2021, 13:20 paolo.bragagni $middlewareQueue->add(new AuthorizationMiddleware($this, [ 'requireAuthorizationCheck' => false, 'unauthorizedHandler' => [ 'className' => 'Regtosc', 'url' => '/users/login', 'queryParam' => 'redirectUrl', 'exceptions' => [ ForbiddenException::class, MissingIdentityException::class, OtherException::class, ], ], ]));
# Jul 23rd 2021, 13:19 kevin.pfeifer do you have the `ForbiddenException::class` in your exceptions array
# Jul 23rd 2021, 13:18 kevin.pfeifer check your middleware