Connector/Console/Command/MappingCommand.php
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (method_exists($this->logger, 'pushHandler')) {
            $this->logger->pushHandler(new ConsoleHandler($output));
        }

        $this->outputHandler->initialize($input, $output);

        $objectType = $input->getArgument('objectType');

        try {
            $mapping = $this->mappingService->getMappingInformation($objectType);

            foreach ($mapping as $entry) {
                $this->outputHandler->writeLine($entry->getObjectType());

                $headers = [
                    $entry->getOriginAdapterName(),
                    $entry->getDestinationAdapterName(),
                ];

                $rows = [];
                foreach ($entry->getOriginTransferObjects() as $object) {
                    $targetIdentifier = array_filter($entry->getDestinationTransferObjects(), function (TransferObjectInterface $targetObject) use ($object) {
                        return $object->getIdentifier() === $targetObject->getIdentifier();
                    });

                    if (!empty($targetIdentifier)) {
                        $targetIdentifier = array_shift($targetIdentifier);

                        if (method_exists($targetIdentifier, 'getName')) {
                            $targetIdentifier = $targetIdentifier->getName();
                        } else {
                            $targetIdentifier = $targetIdentifier->getIdentifier();
                        }
                    } else {
                        $targetIdentifier = '';
                    }

                    if (method_exists($object, 'getName')) {
                        $objectIdentifier = $object->getName();
                    } else {
                        $objectIdentifier = $object->getIdentifier();
                    }

                    $rows[] = [
                        $objectIdentifier,
                        $targetIdentifier,
                    ];
                }

                $this->outputHandler->createTable($headers, $rows);
            }
        } catch (Exception $exception) {
            $this->logger->error($exception->getMessage());
        } catch (Throwable $exception) {
            $this->logger->error($exception->getMessage());
        }
    }
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (method_exists($this->logger, 'pushHandler')) {
            $this->logger->pushHandler(new ConsoleHandler($output));
        }

        $this->outputHandler->initialize($input, $output);

        $objectType = $input->getArgument('objectType');

        try {
            $mapping = $this->mappingService->getMappingInformation($objectType);

            foreach ($mapping as $entry) {
                $this->outputHandler->writeLine($entry->getObjectType());

                $headers = [
                    $entry->getOriginAdapterName(),
                    $entry->getDestinationAdapterName(),
                ];

                $rows = [];
                foreach ($entry->getOriginTransferObjects() as $object) {
                    $targetIdentifier = array_filter($entry->getDestinationTransferObjects(), function (TransferObjectInterface $targetObject) use ($object) {
                        return $object->getIdentifier() === $targetObject->getIdentifier();
                    });

                    if (!empty($targetIdentifier)) {
                        $targetIdentifier = array_shift($targetIdentifier);

                        if (method_exists($targetIdentifier, 'getName')) {
                            $targetIdentifier = $targetIdentifier->getName();
                        } else {
                            $targetIdentifier = $targetIdentifier->getIdentifier();
                        }
                    } else {
                        $targetIdentifier = '';
                    }

                    if (method_exists($object, 'getName')) {
                        $objectIdentifier = $object->getName();
                    } else {
                        $objectIdentifier = $object->getIdentifier();
                    }

                    $rows[] = [
                        $objectIdentifier,
                        $targetIdentifier,
                    ];
                }

                $this->outputHandler->createTable($headers, $rows);
            }
        } catch (Exception $exception) {
            $this->logger->error($exception->getMessage());
        } catch (Throwable $exception) {
            $this->logger->error($exception->getMessage());
        }
    }
protected function execute ( InputInterface $ input , OutputInterface $ output ) { if ( method_exists ( $ this -> logger , 'pushHandler' ) ) { $ this -> logger -> pushHandler ( new ConsoleHandler ( $ output ) ) ; } $ this -> outputHandler -> initialize ( $ input , $ output ) ; $ objectType = $ input -> getArgument ( 'objectType' ) ; try { $ mapping = $ this -> mappingService -> getMappingInformation ( $ objectType ) ; foreach ( $ mapping as $ entry ) { $ this -> outputHandler -> writeLine ( $ entry -> getObjectType ( ) ) ; $ headers = [ $ entry -> getOriginAdapterName ( ) , $ entry -> getDestinationAdapterName ( ) , ] ; $ rows = [ ] ; foreach ( $ entry -> getOriginTransferObjects ( ) as $ object ) { $ targetIdentifier = array_filter ( $ entry -> getDestinationTransferObjects ( ) , function ( TransferObjectInterface $ targetObject ) use ( $ object ) { return $ object -> getIdentifier ( ) === $ targetObject -> getIdentifier ( ) ; } ) ; if ( ! empty ( $ targetIdentifier ) ) { $ targetIdentifier = array_shift ( $ targetIdentifier ) ; if ( method_exists ( $ targetIdentifier , 'getName' ) ) { $ targetIdentifier = $ targetIdentifier -> getName ( ) ; } else { $ targetIdentifier = $ targetIdentifier -> getIdentifier ( ) ; } } else { $ targetIdentifier = '' ; } if ( method_exists ( $ object , 'getName' ) ) { $ objectIdentifier = $ object -> getName ( ) ; } else { $ objectIdentifier = $ object -> getIdentifier ( ) ; } $ rows [ ] = [ $ objectIdentifier , $ targetIdentifier , ] ; } $ this -> outputHandler -> createTable ( $ headers , $ rows ) ; } } catch ( Exception $ exception ) { $ this -> logger -> error ( $ exception -> getMessage ( ) ) ; } catch ( Throwable $ exception ) { $ this -> logger -> error ( $ exception -> getMessage ( ) ) ; } }
{@inheritdoc}
{