PageableManagerInterface error in SonataAdminBundle - sonata-admin

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

Related

Testing after update: The plugin class `WyriHaximus\TwigView\Plugin` cannot be found

I started update CakePHP 3.5 to 3.6, but when I try check my code by tests, i got error:
InvalidArgumentException: The plugin class Migrations\Plugin cannot be found. Ensure your autoloader is correct.
After, I runed command php composer.phar require --dev phpunit/phpunit:"^5.7|^6.0"
Now a got next error:
InvalidArgumentException: The plugin class WyriHaximus\TwigView\Plugin cannot be found. Ensure your autoloader is correct.
And I don't used this plugin before.
Also I used this release files for update deprecated code
How I can fix it, and what could provoke this problem?
Full error:
3) App\Test\TestCase\Controller\CardsControllerTest::testEditPostError
InvalidArgumentException: The plugin class `WyriHaximus\TwigView\Plugin` cannot be found. Ensure your autoloader is correct.
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\BaseApplication.php:127
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\BaseApplication.php:95
C:\work\OSPanel\domains\project.loc\vendor\cakephp\bake\src\Plugin.php:50
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\BaseApplication.php:154
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\Server.php:124
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\Http\Server.php:82
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\TestSuite\MiddlewareDispatcher.php:149
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCase.php:495
C:\work\OSPanel\domains\project.loc\vendor\cakephp\cakephp\src\TestSuite\IntegrationTestCase.php:392
C:\work\OSPanel\domains\project.loc\tests\TestCase\Controller\CardsControllerTest.php:229
Thank you.
Make sure you have removed/commented Plugin::routes(); line from your config/routes.php file.

CakePHP 3 Audit Log, working with admin routes?

I'm trying to work with this CakePHP 3 plugin which I think does exactly what I need it to do, but am struggling big time! I'm new to CakePHP 3, composer and fiddling with routes etc (previously CakePHP 2.x and manual installation and never played with routes).
The plugin does not appear to be maintained any longer and the package does not exist when trying to install via composer, so I forked it and cloned the files to /plugins/AuditLog/
I've run updated my app composer.json file, loaded the plugin in my bootstrap.php, and run composer install on /plugins/AuditLog/ to load the dependencies from the plugin composer.json file (not sure if this is the right thing to do?)
In plugins/AuditLog/config/routes.php there is the following code
Router::plugin('AuditLog', function ($routes) {
$routes->prefix('admin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$routes->fallbacks('DashedRoute');
});
So a bit of searching in the CookBook and I read for the first time about 'prefix routing', which from what I can tell means I should be able to reach the pages via /admin/audit-log/audits (for example).
Not surprisingly, I get a missing controller error here
Error: Create the class AdminController below in file: src/Controller/AdminController.php
The instructions for the plugin don't mention anything about creating an admin controller, and there are no controller files anywhere in the plugin at all actually, despite there being views and models.
I'm really out of my depth here, can anyone help me untangle this? Where/how to add which controllers and get them pointing to the right place?

Errors in Routes requests

im working in a project using angularjs and laravel, but i have a bug i think in my application, im not sure since it happens sometimes, not always. Basically when i open or run my application are made some requests to some routes, but sometimes give me a 500 error, and than the error that is shown in the preview is:
RuntimeException in ApiServiceProvider.php line 88:
Unable to boot ApiServiceProvider, configure an API domain or prefix.
I searched online this error and didnt find much info related with this error, does someone have a idea what could it be?
Yes I have solved the problem, the thing is that you are missing configurations.
The way to solve it you have to make a copy of .env.example file and rename it to .env
Do not forget to change you database configurations.
The problem was missing domain or prefix. which is in your case is:
API_PREFIX=api
I`m sure that it should solve your problem.
Helpful hint turn on your debugging environment in config/app.php to 'debug' => env('APP_DEBUG', true)
so you can be more specific with error messages.
I had same problem even if API_PREFIX was set in my .env file.
Simple solution that I found after long struggle was to clear cache:
php artisan chache:clear
php artisan config:cache

Class 'SqlFormatter' is missing CAKEPHP 3 DebugKit

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.

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