Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added checks for parameters expecting other values than strings

  • Loading branch information...
commit 26f1f90b5c17bf1f1eccb630f13a93dd25219935 1 parent cd8dcfd
@lennerd authored
Showing with 8 additions and 0 deletions.
  1. +8 −0 Request/ParamConverter/DoctrineParamConverter.php
View
8 Request/ParamConverter/DoctrineParamConverter.php
@@ -74,6 +74,14 @@ protected function useMethod(ConfigurationInterface $configuration, Request $req
/** @var $parameter \ReflectionParameter */
$name = $parameter->getName();
+ if (null !== $class = $parameter->getClass()) {
+ throw new \LogicException(sprintf('Cannot set parameter "%s" in "%s::%s". Expects instances of "%s".', $name, get_class($repository), $options['method'], $class->getName()));
+ }
+
+ if ($parameter->isArray()) {
+ throw new \LogicException(sprintf('Cannot set parameter "%s" in "%s::%s". Expects array.', $name, get_class($repository), $options['method']));
+ }
+
if (null === $value = $request->attributes->get($name)) {
if (!$parameter->isOptional() || !$parameter->isDefaultValueAvailable()) {
throw new \LogicException(sprintf('Cannot find a value for parameter "%s" in "%s::%s".', $name, get_class($repository), $options['method']));
Please sign in to comment.
Something went wrong with that request. Please try again.