Closed hipoagencia closed 1 month ago
same here. in local development is working well and the production build getting error. anybody same the issue?
This is unrelated to actions I think. It seems more an issue with the application container. can you give more details? Like the filename and the file content of the action?
This is unrelated to actions I think.
It seems more an issue with the application container.
can you give more details? Like the filename and the file content of the action?
i have error in all the actions with call 'ActionName::dispatch', after change to 'ActionName::dispatchAfterResponse' the error dissapear
additional info, I have Action as Listener Queue but sometimes get errors and I simplify retry the job using Laravel Horizon and the job will running well
AppServiceProvider:
Event::listen(OrderAccepted::class, CalculateOrderAccepted::class);
Error:
ReflectionException: Class "App\Actions\Marketplace\Shop\Product\Calculate\CalculateOrderCompleted" does not exist in /app/vendor/laravel/framework/src/Illuminate/Container/Container.php:938
This is unrelated to actions I think. It seems more an issue with the application container. can you give more details? Like the filename and the file content of the action?
i have error in all the actions with call 'ActionName::dispatch', after change to 'ActionName::dispatchAfterResponse' the error dissapear
Can you give me the content of the file and a link to a repository with a reproduction?
Can you give me the content of the file and a link to a repository with a reproduction?
// CalculateOrderAccepted
namespace App\Actions\Marketplace\Shop\Product\Calculate;
use App\Events\OrderAccepted;
use App\Models\Order;
use Illuminate\Contracts\Queue\ShouldQueueAfterCommit;
use Illuminate\Database\Eloquent\Collection;
use Lorisleiva\Actions\Concerns\AsAction;
class CalculateOrderAccepted implements ShouldQueueAfterCommit
{
use AsAction;
public function handle(Order $order, Collection $orderProducts): void
{
foreach ($orderProducts as $orderProduct) {
// revise count means the order has calculated to ongoing meta
if ($order->revise_count) {
continue;
}
$product = $orderProduct->product;
$product->fill([
'ongoing' => $product->ongoing + $orderProduct->quantity,
])->save();
}
}
public function asListener(OrderAccepted $event): void
{
$order = Order::with(['orderProducts.product'])
->find($event->orderId);
// skip empty
if (empty($order) || $order->orderProducts->isEmpty()) {
return;
}
$this->handle($order, $order->orderProducts);
}
}
// OrderAccepted
namespace App\Events;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;
class OrderAccepted
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/**
* Create a new event instance.
*/
public function __construct(
public int|string $orderId,
public array $productIds,
) {
//
}
/**
* Get the channels the event should broadcast on.
*
* @return array<int, \Illuminate\Broadcasting\Channel>
*/
public function broadcastOn(): array
{
return [
new PrivateChannel('channel-name'),
];
}
}
// Call Event
event(new OrderAccepted($order->id, $productIds));
Did you try running composer dump-autoload
?
Furthermore please provide a repository with a minimal reproducible example. Thank you in advance.
Hi guys, 👋
I want to give an update regarding my issue. After spending tens of hours debugging 🧑💻 and feeling a bit foolish 🤦♂️, I discovered the cause: there were more than one project running and accessing the Redis server with the same prefix ⚠️, which caused random errors. One of the running containers was still using old code 🕰️ and didn’t have the relations or action files.
Hello
i'm facing this error in every action that i use:
ReflectionException: Class "App\Actions\Model\ThreeSixty\Mail\SendIndicatedEmail" does not exist in /home/forge/mastersoul.com.br/vendor/laravel/framework/src/Illuminate/Container/Container.php:912
I didnt change any of the code in weeks