Fix bug with non serializing recursive departure
This commit is contained in:
parent
cde6507197
commit
7279f2096e
@ -1,4 +1,8 @@
|
|||||||
jms_serializer:
|
jms_serializer:
|
||||||
|
default_context:
|
||||||
|
serialization:
|
||||||
|
serialize_null: true
|
||||||
|
|
||||||
visitors:
|
visitors:
|
||||||
xml_serialization:
|
xml_serialization:
|
||||||
format_output: '%kernel.debug%'
|
format_output: '%kernel.debug%'
|
||||||
|
@ -42,7 +42,7 @@ export class PickerStopComponent extends Vue {
|
|||||||
[lines => lines.length > 2, ([first]) => `${first.symbol}…`],
|
[lines => lines.length > 2, ([first]) => `${first.symbol}…`],
|
||||||
);
|
);
|
||||||
|
|
||||||
return unique(this.stop.destinations || [], destination => destination.stop.name).map(compactLines);
|
return unique(this.stop.destinations || [], destination => destination.stop && destination.stop.name).map(compactLines);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ use App\Event\PostProcessEvent;
|
|||||||
use App\Handler\PostProcessingHandler;
|
use App\Handler\PostProcessingHandler;
|
||||||
use App\Model\Destination;
|
use App\Model\Destination;
|
||||||
use App\Model\Stop;
|
use App\Model\Stop;
|
||||||
|
use App\Service\CacheableConverter;
|
||||||
use App\Service\Converter;
|
use App\Service\Converter;
|
||||||
use App\Service\IdUtils;
|
use App\Service\IdUtils;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
@ -25,6 +26,11 @@ class WithDestinationsDatabaseHandler implements PostProcessingHandler
|
|||||||
$this->em = $entityManager;
|
$this->em = $entityManager;
|
||||||
$this->converter = $converter;
|
$this->converter = $converter;
|
||||||
$this->id = $id;
|
$this->id = $id;
|
||||||
|
|
||||||
|
if ($this->converter instanceof CacheableConverter) {
|
||||||
|
$this->converter = clone $this->converter;
|
||||||
|
$this->converter->flushCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function postProcess(PostProcessEvent $event)
|
public function postProcess(PostProcessEvent $event)
|
||||||
|
@ -3,8 +3,9 @@
|
|||||||
namespace App\Service;
|
namespace App\Service;
|
||||||
|
|
||||||
use Tightenco\Collect\Support\Collection;
|
use Tightenco\Collect\Support\Collection;
|
||||||
|
use function Kadet\Functional\Predicates\instance;
|
||||||
|
|
||||||
class AggregateConverter implements Converter
|
class AggregateConverter implements Converter, CacheableConverter
|
||||||
{
|
{
|
||||||
private $converters;
|
private $converters;
|
||||||
|
|
||||||
@ -42,4 +43,22 @@ class AggregateConverter implements Converter
|
|||||||
{
|
{
|
||||||
return clone $this->converters;
|
return clone $this->converters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function flushCache()
|
||||||
|
{
|
||||||
|
$this
|
||||||
|
->converters
|
||||||
|
->filter(instance(CacheableConverter::class))
|
||||||
|
->each(function (CacheableConverter $converter) {
|
||||||
|
$converter->flushCache();
|
||||||
|
})
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function __clone()
|
||||||
|
{
|
||||||
|
$this->converters = $this->converters->map(function ($object) {
|
||||||
|
return clone $object;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ final class SerializerContextFactory
|
|||||||
|
|
||||||
public function create($subject, array $groups = ['Default'])
|
public function create($subject, array $groups = ['Default'])
|
||||||
{
|
{
|
||||||
return SerializationContext::create()->setGroups($this->groups($subject, $groups));
|
return SerializationContext::create()->setSerializeNull(true)->setGroups($this->groups($subject, $groups));
|
||||||
}
|
}
|
||||||
|
|
||||||
private function groups($subject, array $groups)
|
private function groups($subject, array $groups)
|
||||||
|
Loading…
Reference in New Issue
Block a user