Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
CollectionNormalizer example
/** * Gets the public 'tsantos_serializer' shared service. * * @return \TSantos\Serializer\EventEmitterSerializer */
protected
static
function
getTsantosSerializerService
(
$container
)
{
$a
=
new
\TSantos\Serializer\
NormalizerRegistry
(
)
;
$b
=
new
\TSantos\Serializer\Normalizer\
CollectionNormalizer
(
)
;
$c
=
new
\TSantos\Serializer\EventDispatcher\
EventDispatcher
(
)
;
$c
->
addSubscriber
(
new
\TSantos\SerializerBundle\EventListener\
StopwatchListener
(
new
\Symfony\Component\Stopwatch\
Stopwatch
(
true
)
)
)
;
$container
->services
[
'tsantos_serializer'
]
=
$instance
=
new
\TSantos\Serializer\
EventEmitterSerializer
(
new
\TSantos\Serializer\Encoder\
JsonEncoder
(
)
,
$a
,
$c
)
;
$b
->
setSerializer
(
$instance
)
;
$d
=
new
\TSantos\Serializer\Normalizer\
JsonNormalizer
(
)
;
$d
->
setSerializer
(
$instance
)
;
$a
->
add
(
new
\TSantos\Serializer\Normalizer\
ObjectNormalizer
(
new
\TSantos\SerializerBundle\Serializer\
CircularReferenceHandler
(
)
)
)
;