# |
Jul 24th 2021, 22:53 |
jojomartius |
true taht |
# |
Jul 24th 2021, 22:52 |
kevin.pfeifer |
well thats a bit too harsh in my opinion ^^ If your not in sync with the app template then I would just go file by file and check what differs |
# |
Jul 24th 2021, 22:50 |
jojomartius |
but i guess the best way is just dropping the application into a seperate folder, starting with a new cakephp/app and migrating stuff over |
# |
Jul 24th 2021, 22:50 |
kevin.pfeifer |
let me check something |
# |
Jul 24th 2021, 22:50 |
jojomartius |
yes, you'r right. but i guess it came with 4.0 or something. too long ago |
# |
Jul 24th 2021, 22:48 |
jojomartius |
but the bad part is... also if i clear the skip log thing |
# |
Jul 24th 2021, 22:48 |
kevin.pfeifer |
well the Application.php is pretty important since it is used in literally the first php file loaded :) (webroot/index.php) |
# |
Jul 24th 2021, 22:48 |
jojomartius |
hehe ya now its not writing it into the logfile :) |
# |
Jul 24th 2021, 22:47 |
jojomartius |
i do remember that i somehow missed the point when the "Application.php" was introduced and i had some trouble to get it working, so maybe i did something stupid back in this days |
# |
Jul 24th 2021, 22:46 |
jojomartius |
well.. guess that could be the problem |
# |
Jul 24th 2021, 22:46 |
jojomartius |
but theres a lot of interesting stuff inside the "new" app |
# |
Jul 24th 2021, 22:45 |
kevin.pfeifer |
which is not the problem here because I got that too |
# |
Jul 24th 2021, 22:44 |
kevin.pfeifer |
I also just noticed, that there is an issue open for duplicate errorHandler instances created in the template https://github.com/cakephp/app/issues/842 |
# |
Jul 24th 2021, 22:43 |
kevin.pfeifer |
yea, keeping the project up2date with the cakephp/app template can be a bit challenging sometimes :) |
# |
Jul 24th 2021, 22:43 |
jojomartius |
i think thats a good point to start debugging :) |
# |
Jul 24th 2021, 22:43 |
jojomartius |
guess this comes from updating and upgrading from older cake versions over and over again ;) |
# |
Jul 24th 2021, 22:42 |
jojomartius |
yes, just compared config/boostrap.php with https://github.com/cakephp/app/blob/master/config/bootstrap.php, looks pretty different. but also replacing it with the standard one doesnt help |
# |
Jul 24th 2021, 22:37 |
kevin.pfeifer |
well then either look for `Configure::write` or check your `config/bootstrap.php` if some other config files are loaded which could overwrite your main config |
# |
Jul 24th 2021, 22:35 |
jojomartius |
you'r right. well i havn't foudn whats overwriting the config but when i dump getconfig in `vendor/cakephp/cakephp/src/Error/ErrorLogger.php` line 77, it says its an empty array |
# |
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 |