Class 'SqlFormatter' is missing CAKEPHP 3 DebugKit - cakephp

I've just installed the latest Debugkit from https://github.com/cakephp/debug_kit.
Everything is working. However, when I clicked on the "SQL Log", the CakePHP logo keeps spinning. I tried to debug by opening up the console.log and saw an 500 error. It shows the below.
Error: Class 'SqlFormatter' not found
File /Applications/MAMP/htdocs/App/vendor/cakephp/debug_kit/src/Template/Element/sql_log_panel.ctp
Line: 24
From my understanding, SqlFormatter class is not found in sql_log_panel.ctp. How can I add/declare the SqlFormatter class?

Just install it via composer, problem very likely solved then.
https://getcomposer.org/doc/00-intro.md
http://book.cakephp.org/3.0/en/installation.html#installing-cakephp
I highly recommend you to become familiar with composer, it is a standard tool for php developers for some time now. Composer will automatically install the dependencies for you.
Your second best option would be to download the SqlFormatter package manually from where ever it comes from and set your autoloading or include manually up.

Related

How do I load the latest code in Cake REPL?

When I make changes to my Entity code, the changes only reflect after restarting the REPL console. How do I always have the latest code in my REPL console?
./bin/cake console
> $ac_table = Cake\Datasource\FactoryLocator::get('Table')->get('AccountChannels');
> $ac = $ac_table->find()->first()
> $ac->someFunc(); // I can only see changes to this function after restarting the console
I also tried to reload the entity with the first() call after a code change, but no luck.
CakePHP uses PsySH under the hood, and currently it doesn't support code reloading, unless you can get a runkit version with import support running in your PHP environment.
Hey there's an existing fork of runkit for php7. Unfortunatly the runkit_import function was removed in version 4.0.0a1, apparently because of bugs with php7.3+, so this will not work for latest versions of php, but it should be mostly ok for earlier versions (haven't fully tested though). To install:
pecl install runkit7-3.1.0a1
I created a PR to update RunkitReloader.php class
(nb: might not work for class props, see pr modifications)
https://github.com/bobthecow/psysh/issues/416#issuecomment-776631583
https://github.com/bobthecow/psysh/issues/416

Permanently resolve Unable to watch for file changes in this large workspace

To resolve this issue I got there to the link provided by vscode
https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
Ok, this, corrects the error, But when I restart the Linux and again open my React project,
I get the Same error.
max_user_watches file again gets the value of 8192 as no. of max files.
My react server is not starting due to this issue.
Then I again follow the same step of the link provided, this sometimes gets frustrating.
Any permanent Help I could get from you.
A workaround:
Just disable this built-in extension: TypeScript and JavaScript Language Features

ANDROID: java.util.MissingResourceException: Can't find resource for bundle 'org.eclipse.paho.client.mqttv3.internal.nls.logcat_en_US', key ''

There seems to be countless reports of this bug in Stack Overflow. None of the suggestions worked. In my case it is almost identical to this stack overflow report
SPRING
except this case is in Android being built in Android Studio. It only happens in release mode with proguard. Proguard corrupts it somehow. And yes I have done the following in proguard:
-keep class org.eclipse.paho.client.mqttv3.logging.JSR47Logger { *; }
-keep class org.eclipse.paho.** { *; }
I have also parsed the jars downloaded by gradle. I cannot update to 1.2.1 because that only works with the latest versions of Android ... according to comments made by the developers. If I could get the source code for 1.1.0 maybe I could stop it from calling a resource that does not exist.
Anyone solve this problem or is it a bug in proguard/paho?
Looking at the apks generated by release builds (uses proguard) and debug builds (no proguard) shows that proguard is taking the org.eclipse.... package name of the properties and changing the 'org' to some letter like 'c'. The mqtt paho client is looking for the property file using the full package name and therefore cannot find it, no matter what you include or exclude in proguard. I looked at an apk made a few months ago (I have not done anything with the paho client or that part of the code using the paho client ... it has worked fine and I have had no need to change it). I see in that old release apk that the 'org' is there as it should be.
So the problem is in proguard. All I could do to move forward is take the source files for 1.1.0, create a new java project module, and tediously comment out every 'log' and getLogger in the source code. Its a temporary and unpleasant fix but it works. When proguard (R8) fixes this, then I can go back to what I had.
So I guess the only real fix is to submit a bug to R8. That I have not done.

PageableManagerInterface error in SonataAdminBundle

I'm trying to configure SonataAdminBundle and SonataUserBundle to use mongodb and am getting the following error:
ClassNotFoundException: Attempted to load interface "PageableManagerInterface" from namespace "Sonata\CoreBundle\Model" in /Users/me/Sites/mynamespace-webtools/vendor/sonata-project/user-bundle/Model/UserManagerInterface.php line 25. Do you need to "use" it from another namespace?
Can anyone shed any light on what might be causing this? I was also getting the symptoms described here and have tried the answers suggested there.
Can anyone confirm if the mongodb functionality is just broken? Am also wondering if this error relates to this commit?
This appears to be a dependency error within the Sonata system itself, and not strictly related to the MongoDB module.
The PageableManagerInterface class is provided by the Sonata Core Bundle. Make sure that you have it in your composer.json file:
"require": {
"sonata-project/core-bundle": "dev-master",
}
After that, make sure your install is up to date and clean your cache, as usual:
php composer.phar self-update ; php composer.phar update

CakePHP searching for DebugKit at wrong path

I am trying to import DebugKit and CakePHP is producing the following error: DebugKit.ToolbarComponent could not be found.
Right below it, it says:
Create the class ToolbarComponent below in file:
/Users/SomeUser/Sites/SomeProject/app/Plugin/DebugKit//Controller/Component/ToolbarComponent.php
If you notice though, there are two slashes between DebugKit and Controller for some reason, and that's obviously not a real directory. The server running PHP 5.4.17. I have followed the exact installation instructions listed here. Any suggestions?
I had the same problem and solved it by changing the permissions to 755 to folders within DebugKit.
When I encountered this problem, I realized I had a Plugin/DebugKit folder structure in my project's root, and under the app directory. The one under app was empty, save for a blank file called empty. Strange. I have no idea how this happened. (Perhaps from accidentally running composer as non-root?) I deleted app/Plugin/DebugKit, and moved the one from the project root into app. No more error.
DebugKit does not currently seem to be compatible with cakephp 3.0 even though it is the example in the documentation.
The latest version still seems to use the 2.x methods.
I will also submit a ticket regarding this to update their documentation to prevent confusion.
If there is something I missed regarding this issue and it is actually possible to install this, let me know.

Resources