TplBlock/vendor/jms/serializer/tests/Metadata/Driver/php/ObjectWithHandlerCallbacks.php
2018-03-26 21:57:35 +02:00

17 lines
598 B
PHP

<?php
use JMS\Serializer\GraphNavigator;
use JMS\Serializer\Metadata\ClassMetadata;
use JMS\Serializer\Metadata\PropertyMetadata;
$metadata = new ClassMetadata('JMS\Serializer\Tests\Fixtures\ObjectWithHandlerCallbacks');
$pMetadata = new PropertyMetadata('JMS\Serializer\Tests\Fixtures\ObjectWithHandlerCallbacks', 'name');
$pMetadata->type = 'string';
$metadata->addPropertyMetadata($pMetadata);
$metadata->addHandlerCallback(GraphNavigator::DIRECTION_SERIALIZATION, 'json', 'toJson');
$metadata->addHandlerCallback(GraphNavigator::DIRECTION_SERIALIZATION, 'xml', 'toXml');
return $metadata;