Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Issue in /main/src/pages/development/components/routing.md

Đang mở Phù hợp với người mới
#457 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
Dưới một giờ
Mức phù hợp với người mới
90/100
Loại issue
Tài liệu
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
php
Lĩnh vực
documentation

Hướng nghiên cứu

Mở main/src/pages/development/components/routing.md và tìm phần “Example of routing usage”. So sánh ví dụ với vendor/magento/framework/App/ActionFactory.php, sau đó xóa đối số thứ hai không được sử dụng khỏi lệnh gọi ActionFactory::create(). Hoàn tất khi ví dụ khớp với chữ ký phương thức được ghi trong tài liệu và giữ lại các tham số request đã được thiết lập trên đối tượng request.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

In the Routing documentation under the "Example of routing usage" section, the custom Router class example passes a second argument to ActionFactory::create():

return $this->actionFactory->create(Forward::class, ['request' => $request]);

However, Magento\Framework\App\ActionFactory::create() only accepts a single parameter ($actionName). The second argument ['request' => $request] is never used.

Reference:
vendor/magento/framework/App/ActionFactory.php

public function create($actionName)
{
if (!is_subclass_of($actionName, \Magento\Framework\App\ActionInterface::class)) {
throw new \InvalidArgumentException(
'The action name provided is invalid. Verify the action name and try again.'
);
}
return $this->_objectManager->create($actionName);
}

Suggested fix:

return $this->actionFactory->create(Forward::class);

The request parameters (moduleName, controllerName, actionName) are already set on the $request object prior to this line, so the Forward action will read them from the request directly. No additional constructor arguments are needed.

Ngôn ngữ chính
JavaScript
Star
11
Fork
178
Merge trung bình
1 ngày 3 giờ
Pull request đã merge (30 ngày)
2

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AdobeDocs/commerce-php

Tất cả issue của AdobeDocs/commerce-php

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.