Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. MethodNotAllowedException.php

class MethodNotAllowedException

The resource was found but the request method is not allowed.

This exception should trigger an HTTP 405 response in your application code.

@author Kris Wallsmith <kris@symfony.com>

Hierarchy

  • class \Symfony\Component\Routing\Exception\RuntimeException extends \Symfony\Component\Routing\Exception\RuntimeException implements \Symfony\Component\Routing\Exception\ExceptionInterface
    • class \Symfony\Component\Routing\Exception\RuntimeException extends \Symfony\Component\Routing\Exception\RuntimeException implements \Symfony\Component\Routing\Exception\ExceptionInterface
      • class \Symfony\Component\Routing\Exception\MethodNotAllowedException extends \Symfony\Component\Routing\Exception\RuntimeException implements \Symfony\Component\Routing\Exception\ExceptionInterface

Expanded class hierarchy of MethodNotAllowedException

9 files declare their use of MethodNotAllowedException
CompiledUrlMatcherTrait.php in vendor/symfony/routing/Matcher/Dumper/CompiledUrlMatcherTrait.php
MethodFilter.php in core/lib/Drupal/Core/Routing/MethodFilter.php
PathBasedBreadcrumbBuilder.php in core/modules/system/src/PathBasedBreadcrumbBuilder.php
PathValidator.php in core/lib/Drupal/Core/Path/PathValidator.php
RequestMatcherInterface.php in vendor/symfony/routing/Matcher/RequestMatcherInterface.php

... See full list

File

vendor/symfony/routing/Exception/MethodNotAllowedException.php, line 21

Namespace

Symfony\Component\Routing\Exception
View source
class MethodNotAllowedException extends \RuntimeException implements ExceptionInterface {
    protected array $allowedMethods = [];
    
    /**
     * @param string[] $allowedMethods
     */
    public function __construct(array $allowedMethods, string $message = '', int $code = 0, ?\Throwable $previous = null) {
        $this->allowedMethods = array_map('strtoupper', $allowedMethods);
        parent::__construct($message, $code, $previous);
    }
    
    /**
     * Gets the allowed HTTP methods.
     *
     * @return string[]
     */
    public function getAllowedMethods() : array {
        return $this->allowedMethods;
    }

}

Members

Title Sort descending Modifiers Object type Summary
MethodNotAllowedException::$allowedMethods protected property
MethodNotAllowedException::getAllowedMethods public function Gets the allowed HTTP methods.
MethodNotAllowedException::__construct public function

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal