Exceptions
Exceptions 2
Symfony\Component\PropertyAccess\Exception\ InvalidArgumentException
in
vendor/symfony/property-access/PropertyAccessor.php
(line 274)
}
if (preg_match('/^\S+::\S+\(\): Argument #\d+ \(\$\S+\) must be of type (\S+), (\S+) given/', $message, $matches)) {
[, $expectedType, $actualType] = $matches;
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $expectedType, 'NULL' === $actualType ? 'null' : $actualType, $propertyPath), 0, $previous);
}
if (preg_match('/^Cannot assign (\S+) to property \S+::\$\S+ of type (\S+)$/', $message, $matches)) {
[, $actualType, $expectedType] = $matches;
throw new InvalidArgumentException(sprintf('Expected argument of type "%s", "%s" given at property path "%s".', $expectedType, 'NULL' === $actualType ? 'null' : $actualType, $propertyPath), 0, $previous);
in
vendor/symfony/property-access/PropertyAccessor.php
::
throwInvalidArgumentException
(line 179)
try {
$this->writeProperty($zval, $propertyPath, $value);
return;
} catch (\TypeError $e) {
self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $propertyPath, $e);
// It wasn't thrown in this class so rethrow it
throw $e;
}
}
in
vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php
->
setValue
(line 69)
}
// If the data is identical to the value in $data, we are
// dealing with a reference
if (!\is_object($data) || !$form->getConfig()->getByReference() || $propertyValue !== $this->getPropertyValue($data, $propertyPath)) {
$this->propertyAccessor->setValue($data, $propertyPath, $propertyValue);
}
}
/**
* {@inheritdoc}
in
vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php
->
setValue
(line 54)
*/
public function setValue(&$data, $value, FormInterface $form): void
{
foreach ($this->accessors as $accessor) {
if ($accessor->isWritable($data, $form)) {
$accessor->setValue($data, $value, $form);
return;
}
}
in
vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php
->
setValue
(line 87)
$config = $form->getConfig();
// Write-back is disabled if the form is not synchronized (transformation failed),
// if the form was not submitted and if the form is disabled (modification not allowed)
if ($config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled() && $this->dataAccessor->isWritable($data, $form)) {
$this->dataAccessor->setValue($data, $form->getData(), $form);
}
}
}
}
in
vendor/symfony/form/Form.php
->
mapFormsToData
(line 641)
if (\count($this->children) > 0) {
// Use InheritDataAwareIterator to process children of
// descendants that inherit this form's data.
// These descendants will not be submitted normally (see the check
// for $this->config->getInheritData() above)
$this->config->getDataMapper()->mapFormsToData(
new \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children)),
$viewData
);
}
in
vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
->
submit
(line 110)
// Don't auto-submit the form unless at least one field is present.
if ('' === $name && \count(array_intersect_key($data, $form->all())) <= 0) {
return;
}
$form->submit($data, 'PATCH' !== $method);
}
/**
* {@inheritdoc}
*/
in
vendor/symfony/form/Form.php
->
handleRequest
(line 503)
/**
* {@inheritdoc}
*/
public function handleRequest($request = null)
{
$this->config->getRequestHandler()->handleRequest($this, $request);
return $this;
}
/**
// $movimiento->setProyecto($proyecto);
// } else {
// $proyecto = null;
// }
$form = $this->createForm(FacturaType::class, $movimiento);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($movimiento);
$entityManager->flush();
// if ($proyecto) {
in
vendor/symfony/http-kernel/HttpKernel.php
->
new
(line 163)
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
in
vendor/symfony/http-kernel/HttpKernel.php
->
handleRaw
(line 75)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
in
vendor/symfony/http-kernel/Kernel.php
->
handle
(line 202)
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
in
vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php
->
handle
(line 35)
$this->request = $request;
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
$response->send();
if ($this->kernel instanceof TerminableInterface) {
$this->kernel->terminate($this->request, $response);
}
in
vendor/autoload_runtime.php
->
run
(line 35)
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
TypeError
in
src/Entity/Movimiento.php
(line 405)
}
/**
* @param float $monto_neto
*/
public function setMontoNeto(float $monto_neto): void
{
$this->monto_neto = $monto_neto;
}
/**
in
vendor/symfony/property-access/PropertyAccessor.php
->
setMontoNeto
(line 591)
if (PropertyWriteInfo::TYPE_NONE !== $mutator->getType()) {
$type = $mutator->getType();
if (PropertyWriteInfo::TYPE_METHOD === $type) {
$object->{$mutator->getName()}($value);
} elseif (PropertyWriteInfo::TYPE_PROPERTY === $type) {
$object->{$mutator->getName()} = $value;
} elseif (PropertyWriteInfo::TYPE_ADDER_AND_REMOVER === $type) {
$this->writeCollection($zval, $property, $value, $mutator->getAdderInfo(), $mutator->getRemoverInfo());
}
in
vendor/symfony/property-access/PropertyAccessor.php
->
writeProperty
(line 175)
$zval = [
self::VALUE => $objectOrArray,
];
try {
$this->writeProperty($zval, $propertyPath, $value);
return;
} catch (\TypeError $e) {
self::throwInvalidArgumentException($e->getMessage(), $e->getTrace(), 0, $propertyPath, $e);
// It wasn't thrown in this class so rethrow it
in
vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php
->
setValue
(line 69)
}
// If the data is identical to the value in $data, we are
// dealing with a reference
if (!\is_object($data) || !$form->getConfig()->getByReference() || $propertyValue !== $this->getPropertyValue($data, $propertyPath)) {
$this->propertyAccessor->setValue($data, $propertyPath, $propertyValue);
}
}
/**
* {@inheritdoc}
in
vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php
->
setValue
(line 54)
*/
public function setValue(&$data, $value, FormInterface $form): void
{
foreach ($this->accessors as $accessor) {
if ($accessor->isWritable($data, $form)) {
$accessor->setValue($data, $value, $form);
return;
}
}
in
vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php
->
setValue
(line 87)
$config = $form->getConfig();
// Write-back is disabled if the form is not synchronized (transformation failed),
// if the form was not submitted and if the form is disabled (modification not allowed)
if ($config->getMapped() && $form->isSubmitted() && $form->isSynchronized() && !$form->isDisabled() && $this->dataAccessor->isWritable($data, $form)) {
$this->dataAccessor->setValue($data, $form->getData(), $form);
}
}
}
}
in
vendor/symfony/form/Form.php
->
mapFormsToData
(line 641)
if (\count($this->children) > 0) {
// Use InheritDataAwareIterator to process children of
// descendants that inherit this form's data.
// These descendants will not be submitted normally (see the check
// for $this->config->getInheritData() above)
$this->config->getDataMapper()->mapFormsToData(
new \RecursiveIteratorIterator(new InheritDataAwareIterator($this->children)),
$viewData
);
}
in
vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
->
submit
(line 110)
// Don't auto-submit the form unless at least one field is present.
if ('' === $name && \count(array_intersect_key($data, $form->all())) <= 0) {
return;
}
$form->submit($data, 'PATCH' !== $method);
}
/**
* {@inheritdoc}
*/
in
vendor/symfony/form/Form.php
->
handleRequest
(line 503)
/**
* {@inheritdoc}
*/
public function handleRequest($request = null)
{
$this->config->getRequestHandler()->handleRequest($this, $request);
return $this;
}
/**
// $movimiento->setProyecto($proyecto);
// } else {
// $proyecto = null;
// }
$form = $this->createForm(FacturaType::class, $movimiento);
$form->handleRequest($request);
if ($form->isSubmitted() && $form->isValid()) {
$entityManager->persist($movimiento);
$entityManager->flush();
// if ($proyecto) {
in
vendor/symfony/http-kernel/HttpKernel.php
->
new
(line 163)
$this->dispatcher->dispatch($event, KernelEvents::CONTROLLER_ARGUMENTS);
$controller = $event->getController();
$arguments = $event->getArguments();
// call controller
$response = $controller(...$arguments);
// view
if (!$response instanceof Response) {
$event = new ViewEvent($this, $request, $type, $response);
$this->dispatcher->dispatch($event, KernelEvents::VIEW);
in
vendor/symfony/http-kernel/HttpKernel.php
->
handleRaw
(line 75)
{
$request->headers->set('X-Php-Ob-Level', (string) ob_get_level());
$this->requestStack->push($request);
try {
return $this->handleRaw($request, $type);
} catch (\Exception $e) {
if ($e instanceof RequestExceptionInterface) {
$e = new BadRequestHttpException($e->getMessage(), $e);
}
if (false === $catch) {
in
vendor/symfony/http-kernel/Kernel.php
->
handle
(line 202)
$this->boot();
++$this->requestStackSize;
$this->resetServices = true;
try {
return $this->getHttpKernel()->handle($request, $type, $catch);
} finally {
--$this->requestStackSize;
}
}
in
vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php
->
handle
(line 35)
$this->request = $request;
}
public function run(): int
{
$response = $this->kernel->handle($this->request);
$response->send();
if ($this->kernel instanceof TerminableInterface) {
$this->kernel->terminate($this->request, $response);
}
in
vendor/autoload_runtime.php
->
run
(line 35)
$app = $app(...$args);
exit(
$runtime
->getRunner($app)
->run()
);
<?php
use App\Kernel;
require_once dirname(__DIR__).'/vendor/autoload_runtime.php';
return function (array $context) {
return new Kernel($context['APP_ENV'], (bool) $context['APP_DEBUG']);
};
Stack Traces 2
[2/2]
InvalidArgumentException
|
---|
Symfony\Component\PropertyAccess\Exception\InvalidArgumentException: Expected argument of type "float", "string" given at property path "montoNeto". at vendor/symfony/property-access/PropertyAccessor.php:274 at Symfony\Component\PropertyAccess\PropertyAccessor::throwInvalidArgumentException() (vendor/symfony/property-access/PropertyAccessor.php:179) at Symfony\Component\PropertyAccess\PropertyAccessor->setValue() (vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php:69) at Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor->setValue() (vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php:54) at Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor->setValue() (vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php:87) at Symfony\Component\Form\Extension\Core\DataMapper\DataMapper->mapFormsToData() (vendor/symfony/form/Form.php:641) at Symfony\Component\Form\Form->submit() (vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php:110) at Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler->handleRequest() (vendor/symfony/form/Form.php:503) at Symfony\Component\Form\Form->handleRequest() (src/Controller/FacturaController.php:127) at App\Controller\FacturaController->new() (vendor/symfony/http-kernel/HttpKernel.php:163) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:75) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:202) at Symfony\Component\HttpKernel\Kernel->handle() (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35) at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() (vendor/autoload_runtime.php:35) at require_once('/home/www/juris/vendor/autoload_runtime.php') (public/index.php:5) |
[1/2]
TypeError
|
---|
TypeError: App\Entity\Movimiento::setMontoNeto(): Argument #1 ($monto_neto) must be of type float, string given, called in /home/www/juris/vendor/symfony/property-access/PropertyAccessor.php on line 591 at src/Entity/Movimiento.php:405 at App\Entity\Movimiento->setMontoNeto() (vendor/symfony/property-access/PropertyAccessor.php:591) at Symfony\Component\PropertyAccess\PropertyAccessor->writeProperty() (vendor/symfony/property-access/PropertyAccessor.php:175) at Symfony\Component\PropertyAccess\PropertyAccessor->setValue() (vendor/symfony/form/Extension/Core/DataAccessor/PropertyPathAccessor.php:69) at Symfony\Component\Form\Extension\Core\DataAccessor\PropertyPathAccessor->setValue() (vendor/symfony/form/Extension/Core/DataAccessor/ChainAccessor.php:54) at Symfony\Component\Form\Extension\Core\DataAccessor\ChainAccessor->setValue() (vendor/symfony/form/Extension/Core/DataMapper/DataMapper.php:87) at Symfony\Component\Form\Extension\Core\DataMapper\DataMapper->mapFormsToData() (vendor/symfony/form/Form.php:641) at Symfony\Component\Form\Form->submit() (vendor/symfony/form/Extension/HttpFoundation/HttpFoundationRequestHandler.php:110) at Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler->handleRequest() (vendor/symfony/form/Form.php:503) at Symfony\Component\Form\Form->handleRequest() (src/Controller/FacturaController.php:127) at App\Controller\FacturaController->new() (vendor/symfony/http-kernel/HttpKernel.php:163) at Symfony\Component\HttpKernel\HttpKernel->handleRaw() (vendor/symfony/http-kernel/HttpKernel.php:75) at Symfony\Component\HttpKernel\HttpKernel->handle() (vendor/symfony/http-kernel/Kernel.php:202) at Symfony\Component\HttpKernel\Kernel->handle() (vendor/symfony/runtime/Runner/Symfony/HttpKernelRunner.php:35) at Symfony\Component\Runtime\Runner\Symfony\HttpKernelRunner->run() (vendor/autoload_runtime.php:35) at require_once('/home/www/juris/vendor/autoload_runtime.php') (public/index.php:5) |