mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 02:14:31 +02:00
Fixed an exception related during undeletion of elements.
This commit is contained in:
parent
9996e2280a
commit
2bd41eee60
1 changed files with 16 additions and 0 deletions
|
@ -39,6 +39,7 @@ use Doctrine\Common\Collections\Collection;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
use Doctrine\ORM\Mapping\ClassMetadata;
|
use Doctrine\ORM\Mapping\ClassMetadata;
|
||||||
use Doctrine\ORM\Mapping\MappingException;
|
use Doctrine\ORM\Mapping\MappingException;
|
||||||
|
use DoctrineExtensions\Query\Mysql\Date;
|
||||||
use Exception;
|
use Exception;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
@ -171,6 +172,17 @@ class TimeTravel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function decodes the array which is created during the json_encode of a datetime object and returns a DateTime object.
|
||||||
|
* @param array $input
|
||||||
|
* @return DateTime
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private function dateTimeDecode(array $input): \DateTime
|
||||||
|
{
|
||||||
|
return new \DateTime($input['date'], new \DateTimeZone($input['timezone']));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply the changeset in the given LogEntry to the element.
|
* Apply the changeset in the given LogEntry to the element.
|
||||||
*
|
*
|
||||||
|
@ -195,6 +207,10 @@ class TimeTravel
|
||||||
$data = BigDecimal::of($data);
|
$data = BigDecimal::of($data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$data instanceof DateTime && ('datetime' === $metadata->getFieldMapping($field)['type'])) {
|
||||||
|
$data = $this->dateTimeDecode($data);
|
||||||
|
}
|
||||||
|
|
||||||
$this->setField($element, $field, $data);
|
$this->setField($element, $field, $data);
|
||||||
}
|
}
|
||||||
if ($metadata->hasAssociation($field)) {
|
if ($metadata->hasAssociation($field)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue