Whenever I try to run composer update I now receive an error with a root cause of the following
Call to undefined method Illuminate\Bus\Dispatcher::mapUsing()
I can confirm Laravel 5.2 is properly installed, as are all other dependencies. This only happens when php artisan clear-compiled is run.
I've also updated my base controller based on a suggestion from a few hours ago in the Laracasts forum
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
abstract class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
}
But I still receive the error
UPDATE: This happens whenever the application is bootstrapped at all. My app won't even run now.
UPDATE 2, full stack trace:
PHP Fatal error: Call to undefined method Illuminate\Bus\Dispatcher::mapUsing() in /Users/Zara/Web/cafe/app/Providers/BusServiceProvider.php on line 16
PHP Stack trace:
PHP 1. {main}() /Users/Zara/Web/cafe/artisan:0
PHP 2. Illuminate\Foundation\Console\Kernel->handle() /Users/Zara/Web/cafe/artisan:36
PHP 3. Illuminate\Foundation\Console\Kernel->bootstrap() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:105
PHP 4. Illuminate\Foundation\Application->bootstrapWith() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php:208
PHP 5. Illuminate\Foundation\Bootstrap\BootProviders->bootstrap() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:203
PHP 6. Illuminate\Foundation\Application->boot() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/BootProviders.php:17
PHP 7. array_walk() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 8. Illuminate\Foundation\Application->Illuminate\Foundation\{closure}() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:718
PHP 9. Illuminate\Foundation\Application->bootProvider() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:717
PHP 10. Illuminate\Container\Container->call() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:734
PHP 11. call_user_func_array:{/Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Container/Container.php:507}() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
PHP 12. Cafe\Providers\BusServiceProvider->boot() /Users/Zara/Web/cafe/vendor/laravel/framework/src/Illuminate/Container/Container.php:507
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined method Illuminate\Bus\Dispatcher::mapUsing()
From the Laravel 5.2 Upgrade Guide
Separate Commands & Handlers
The Laravel 5.2 command bus now only supports self-handling commands and no longer supports separate commands and handlers.
If you would like to continue using separate commands and handlers, you may install a Laravel Collective package which provides backwards-compatible support for this: https://github.com/LaravelCollective/bus
There is no longer support for non self handling commands which is what the mapper would be for; mapping commands to handlers.
Check Service Providers
Check any service providers you have registered to make sure they aren't calling that method on dispatcher. If still having that issue, you can try checking any package service providers to make sure they aren't calling that method.
Related
I created an project (let's just call it "myproject") which make use of Guzzle 7.0 itself, and should also use another project called "keycloak-admin-client". I tried to use it this way:
require('/opt/myproject/inc/guzzle7.0/vendor/autoload.php');
require('/opt/myproject/inc/keycloak-admin-client/vendor/autoload.php');
use GuzzleHttp\Client;
...
I can use my own HTTP-Requests with Guzzle 7 included, but in the moment i try to use the Keycloak client i get this errormessage:
PHP Fatal error: Uncaught Error: Call to undefined method GuzzleHttp\Psr7\Uri::resolve() in /op/myproject/inc/keycloak-admin-client/vendor/guzzlehttp/guzzle-services/src/Serializer.php:161
So maybe it's not allowed/possible to use Guzzle two times this way? Or is it the mix of versions? (Keycloak Client uses Guzzle 6.0).
I am using this cron library within my Symfony project. It was working today and after recreating everything from the start (docker, database, vendor folder) and running it again, it crashes.
As it says in documentation I was able to make specific commands and they are persisted in the database.
However when running bin/console cron:start --blocking it throws:
In Manager.php line 60:
Attempted to call an undefined method named "ping" of class
"Doctrine\DBAL\Connection".
And in my log file:
console.ERROR: Error thrown while running command "cron:start --blocking". Message: "Call to undefined method Doctrine\DBAL\Connection::ping()" {"exception":"[object] (Error(code: 0): Call to undefined method Doctrine\\DBAL\\Connection::ping() at /app/vendor/cron/cron-bundle/Cron/Manager.php:60)","command":"cron:start --blocking","message":"Call to undefined method Doctrine\\DBAL\\Connection::ping()"} []
The package you are using is not compatible with doctrine/dbal >= 3.
You can this to your composer.json and reinstall, so that your project uses DBAL 2:
"conflict": {
"doctrine/dbal": "^3.0"
},
Of course, this would depend on you not needing DBAL 3 for anything else.
Although, frankly, I would stop using the Cron/Symfony-Bundle. Seems completely unnecessary. Just add your cronjob tasks directly to your crontab. It's not like the bundle frees you from editing crontab, so you might as well put your tasks there.
I am using Laravel 6.5.2 and trying to use the package "Requests for PHP". https://requests.ryanmccue.info/download/
I installed this package using composer. The reason I want to use this packages is that I have all CRUD scripts created (using above package) and would like to reuse the scripts.
I suspect there might be some name conflict since Laravel comes installed with a HTTP request solution called Request, meanwhile the [PHP Request] has the same name.
Question:
Has anyone succesfully installed [Requests for PHP] package and got it to work with Laravel 6.X ?
Other findings:
Whe comment-out the autoloader line, the corresponding page prints "hello" as it should. Leaving this line active indicates in the laravel stack trace that the error is the line that holds the autoloader.
[Error]
Class 'App\Http\Controllers\Requests' not found
[routes/web.php]
Route::get("/requests", "Requests#read");
[app/Http/Controllers]
<?php
namespace App\Http\Controllers;
// use Illuminate\Http\Request; // Standard line, creeating a controller.
require_once '../vendor/rmccue/requests/library/Requests.php';
Requests::register_autoloader();
class Requests extends Controller {
public function read() {
echo "hello";
}
}
I'm migrating a CakePHP 1.3 app from an old server to a new one, the website works fine but the Shells fail with the following error:
PHP Fatal error: Class 'AppModel' not found
And the error points to the declaration of a model that extends from the AppModel class. It also somewhat strangely prints the contents of the AppModel class to stdout. Full stack trace below.
PHP Fatal error: Class 'AppModel' not found in /home/andyburchill/src/site/app/models/account.php on line 3
PHP Stack trace:
PHP 1. {main}() /home/andyburchill/src/site/cake/console/cake.php:0
PHP 2. ShellDispatcher->ShellDispatcher() /home/andyburchill/src/site/cake/console/cake.php:665
PHP 3. ShellDispatcher->dispatch() /home/andyburchill/src/site/cake/console/cake.php:139
PHP 4. Shell->initialize() /home/andyburchill/src/site/cake/console/cake.php:337
PHP 5. Shell->_loadModels() /home/andyburchill/src/site/cake/console/libs/shell.php:180
PHP 6. ClassRegistry->init() /home/andyburchill/src/site/cake/console/libs/shell.php:257
PHP 7. App->import() /home/andyburchill/src/site/cake/libs/class_registry.php:143
PHP 8. App->__find() /home/andyburchill/src/site/cake/libs/configure.php:962
PHP 9. App->__load() /home/andyburchill/src/site/cake/libs/configure.php:1043
PHP 10. require() /home/andyburchill/src/site/cake/libs/configure.php:1067
I'm running the shell from the root directory with the following command:
./cake/console/cake queue
The most notable difference between the servers is the PHP version, the shells are working on PHP 5.4.9 and are not working on PHP 5.5.9.
I have been googling this for a couple of days, usually people seem to get this error after upgrading to CakePHP 2.x and the fixes don't work for CakePHP 1.3.
I'm beginning to think the only solution is going to be upgrading to 2.x, but this is not a trivial task.
Is there something I can do in the mean time to get this working?, can anyone suggest troubleshooting tips?.
Ok I feel a bit silly now.
I had tried Raphael's suggestion of requiring the class file previously but I decided to try again and noticed that the AppModel class file started with a short open tag instead of <?php.
After changing it the shells now work.
If I use the symfony console command generate:doctrine:crud with --write parameter I get an auto-generated controller working only in the indexAction route, but not in the others (newAction, deleteAction, updateAction). I think the problem is in the form creation.
The resulting error is the following one:
Compile Error: Can't inherit abstract function
Symfony\Component\Validator\ValidatorInterface::validate() (previously
declared abstract in
Symfony\Component\Validator\Validator\ValidatorInterface)
Server Error - FatalErrorException500 Internal in vendor/symfony/symfony/src/Symfony/Component/Validator/Validator/RecursiveValidator.php at line 31
I don't know, how to solve this problem.
This error is the error message you get when running the new validator component in PHP 5.3.8 or older. You need to use at least PHP 5.3.9 to use recent versions of Symfony
The only way to solve this problem is to change ValidatorInterface or to run almost PHP 5.6