| Conditions | 4 |
| Paths | 4 |
| Total Lines | 34 |
| Code Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 20 |
| Changes | 0 | ||
| 1 | <?php |
||
| 14 | public function process(ContainerBuilder $container) |
||
| 15 | { |
||
| 16 | if (!$container->has('jms_serializer.metadata.doctrine_type_driver')) { |
||
| 17 | return; |
||
| 18 | } |
||
| 19 | |||
| 20 | $handler = $container->register('cruds.jms.doctrine_associations_handler', JmsDoctrineHandler::class); |
||
| 21 | |||
| 22 | //fixme: JMS utilizes only public handlers for lazyness |
||
| 23 | $handler->setPublic(true); |
||
| 24 | $handler->addArgument(new Reference('doctrine')); |
||
| 25 | |||
| 26 | $formats = ['json', 'xml', 'array']; |
||
| 27 | $directions = [ |
||
| 28 | 'serialization' => 'serializeRelation', |
||
| 29 | 'deserialization' => 'deserializeRelation', |
||
| 30 | ]; |
||
| 31 | $type = JmsDoctrineHandler::TYPE; |
||
| 32 | $name = 'jms_serializer.handler'; |
||
| 33 | |||
| 34 | foreach ($formats as $format) { |
||
| 35 | foreach ($directions as $direction => $method) { |
||
| 36 | $handler->addTag( |
||
| 37 | $name, |
||
| 38 | [ |
||
| 39 | 'type' => $type, |
||
| 40 | 'direction' => $direction, |
||
| 41 | 'format' => $format, |
||
| 42 | 'method' => $method, |
||
| 43 | ] |
||
| 44 | ); |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | } |
||
| 49 |