LdapTools\Resolver\BaseValueResolver::getConverterWithOptions PHP Method

getConverterWithOptions() protected method

Get an instance of a converter with its options set.
protected getConverterWithOptions ( string $converterName ) : LdapTools\AttributeConverter\AttributeConverterInterface
$converterName string The name of the converter from the schema.
return LdapTools\AttributeConverter\AttributeConverterInterface
    protected function getConverterWithOptions($converterName)
    {
        $converter = AttributeConverterFactory::get($converterName);
        if (isset($this->options[$converterName])) {
            $converter->setOptions($this->options[$converterName]);
        }
        if ($this->connection) {
            $converter->setLdapConnection($this->connection);
        }
        if ($this->dn !== null) {
            $converter->setDn($this->dn);
        }
        if ($converter instanceof OperationGeneratorInterface) {
            $converter->setOperation($this->operation);
        }
        $converter->setOperationType($this->type);
        return $converter;
    }

Usage Example

 /**
  * {@inheritdoc}
  */
 protected function getConverterWithOptions($converterName)
 {
     $converter = parent::getConverterWithOptions($converterName);
     $converter->setBatch($this->batches->get($this->currentBatchIndex));
     return $converter;
 }