Skip to content

Commit f9cd240

Browse files
authored
Merge pull request overblog#656 from olsavmic/mo-olsavmic-patch-1
Allow to use non-empty constructor for input types
2 parents 7295d56 + 0eba83c commit f9cd240

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Transformer/ArgumentsTransformer.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use GraphQL\Type\Definition\Type;
1313
use Overblog\GraphQLBundle\Error\InvalidArgumentError;
1414
use Overblog\GraphQLBundle\Error\InvalidArgumentsError;
15+
use ReflectionClass;
1516
use Symfony\Component\PropertyAccess\PropertyAccess;
1617
use Symfony\Component\PropertyAccess\PropertyAccessor;
1718
use Symfony\Component\Validator\ConstraintViolationList;
@@ -46,7 +47,7 @@ private function getTypeClassInstance(string $type)
4647
{
4748
$classname = isset($this->classesMap[$type]) ? $this->classesMap[$type]['class'] : false;
4849

49-
return $classname ? new $classname() : false;
50+
return $classname ? (new ReflectionClass($classname))->newInstanceWithoutConstructor() : false;
5051
}
5152

5253
/**

0 commit comments

Comments
 (0)