public function convergeCommand($clientName = null)
    {
        $client = $this->clientFactory->create($clientName);

        $entityMappingCollection = $this->entityMappingBuilder->buildMappingInformation();
        $this->backendMappingBuilder->setClient($client);
        $backendMappingCollection = $this->backendMappingBuilder->buildMappingInformation();

        $additiveMappings = $entityMappingCollection->diffAgainstCollection($backendMappingCollection);
        /** @var $mapping Mapping */
        foreach ($additiveMappings as $mapping) {
            $index = $mapping->getType()->getIndex();
            $index->setClient($client);
            if (!$index->exists()) {
                $this->outputFormatted('Index <b>%s</b> does not exist', [$index->getName()]);
                continue;
            }
            $this->outputLine('Attempt to apply properties to %s/%s: %s... ', [
                $index->getName(),
                $mapping->getType()->getName(),
                print_r($mapping->getProperties(), true),
            ]);
            $response = $mapping->apply();
            if ($response->getStatusCode() === 200) {
                $this->outputFormatted('<b>OK</b>');
            } else {
                $this->outputFormatted('<b>NOT OK</b>, response code was %d, response body was: %s', [
                    $response->getStatusCode(),
                    $response->getOriginalResponse()->getContent(),
                ], 4);
            }
        }
        if ($additiveMappings->count() === 0) {
            $this->outputLine('No mappings were to be applied.');
        }
    }
public function convergeCommand($clientName = null)
    {
        $client = $this->clientFactory->create($clientName);

        $entityMappingCollection = $this->entityMappingBuilder->buildMappingInformation();
        $this->backendMappingBuilder->setClient($client);
        $backendMappingCollection = $this->backendMappingBuilder->buildMappingInformation();

        $additiveMappings = $entityMappingCollection->diffAgainstCollection($backendMappingCollection);
        /** @var $mapping Mapping */
        foreach ($additiveMappings as $mapping) {
            $index = $mapping->getType()->getIndex();
            $index->setClient($client);
            if (!$index->exists()) {
                $this->outputFormatted('Index <b>%s</b> does not exist', [$index->getName()]);
                continue;
            }
            $this->outputLine('Attempt to apply properties to %s/%s: %s... ', [
                $index->getName(),
                $mapping->getType()->getName(),
                print_r($mapping->getProperties(), true),
            ]);
            $response = $mapping->apply();
            if ($response->getStatusCode() === 200) {
                $this->outputFormatted('<b>OK</b>');
            } else {
                $this->outputFormatted('<b>NOT OK</b>, response code was %d, response body was: %s', [
                    $response->getStatusCode(),
                    $response->getOriginalResponse()->getContent(),
                ], 4);
            }
        }
        if ($additiveMappings->count() === 0) {
            $this->outputLine('No mappings were to be applied.');
        }
    }
public function convergeCommand ( $ clientName = null ) { $ client = $ this -> clientFactory -> create ( $ clientName ) ; $ entityMappingCollection = $ this -> entityMappingBuilder -> buildMappingInformation ( ) ; $ this -> backendMappingBuilder -> setClient ( $ client ) ; $ backendMappingCollection = $ this -> backendMappingBuilder -> buildMappingInformation ( ) ; $ additiveMappings = $ entityMappingCollection -> diffAgainstCollection ( $ backendMappingCollection ) ; /** @var $mapping Mapping */ foreach ( $ additiveMappings as $ mapping ) { $ index = $ mapping -> getType ( ) -> getIndex ( ) ; $ index -> setClient ( $ client ) ; if ( ! $ index -> exists ( ) ) { $ this -> outputFormatted ( 'Index <b>%s</b> does not exist' , [ $ index -> getName ( ) ] ) ; continue ; } $ this -> outputLine ( 'Attempt to apply properties to %s/%s: %s... ' , [ $ index -> getName ( ) , $ mapping -> getType ( ) -> getName ( ) , print_r ( $ mapping -> getProperties ( ) , true ) , ] ) ; $ response = $ mapping -> apply ( ) ; if ( $ response -> getStatusCode ( ) === 200 ) { $ this -> outputFormatted ( '<b>OK</b>' ) ; } else { $ this -> outputFormatted ( '<b>NOT OK</b>, response code was %d, response body was: %s' , [ $ response -> getStatusCode ( ) , $ response -> getOriginalResponse ( ) -> getContent ( ) , ] , 4 ) ; } } if ( $ additiveMappings -> count ( ) === 0 ) { $ this -> outputLine ( 'No mappings were to be applied.' ) ; } }
This command will adjust the backend's mapping to the mapping the entity status prescribes.

@param string $clientName The client name for the configuration. Defaults to the default client configured.
@return void
This command will adjust the backend s mapping to the mapping the entity status prescribes .