- Merge request !41Issue #3314032: MissingMandatoryParametersException is not caught in redirect_entity_delete → (Merged) created by keszthelyi
- 🇮🇳India sumit-k
After replicating the issue, I can confirm that Patch #2 resolves the issue satisfactorily. Additionally, I've introduced an alternative method to handle straightforward exceptions, which has proven effective in addressing the problem in my scenario.
function redirect_entity_delete(EntityInterface $entity) { try { if ($entity->getEntityType()->hasLinkTemplate('canonical') && $entity->toUrl('canonical')->isRouted()) { // Generate the canonical URL after setting the required parameters. $canonical_url = $entity->toUrl('canonical'); // Check if the canonical URL has the required parameters set. try { if ($canonical_url->getRouteParameters()) { redirect_delete_by_path('internal:/' . $entity->toUrl('canonical')->getInternalPath()); } } catch (Exception $e) { // This can happen if some mandatory parameters are missing. } redirect_delete_by_path('entity:' . $entity->getEntityTypeId() . '/' . $entity->id()); } } catch (RouteNotFoundException $e) { // This can happen if a module incorrectly defines a link template, ignore // such errors. } }
- First commit to issue fork.
- Status changed to RTBC
4 months ago 9:31pm 22 July 2024 - heddn Nicaragua
Not sure what extra testing we want to do here. I tested this coming from 🐛 Error when removing a menu Needs work and it solved the problem perfectly.
-
Berdir →
committed f900de0c on 8.x-1.x authored by
keszthelyi →
Issue #3314032 by keszthelyi: MissingMandatoryParametersException is not...
-
Berdir →
committed f900de0c on 8.x-1.x authored by
keszthelyi →
- Status changed to Fixed
4 months ago 9:54pm 7 August 2024 Automatically closed - issue fixed for 2 weeks with no activity.