getDomainConfiguration() public method

Get the DomainConfiguration for a specific domain, or an array of all DomainConfiguration objects if none is specified.
public getDomainConfiguration ( null | string $domain = null ) : DomainConfiguration[] | DomainConfiguration
$domain null | string
return DomainConfiguration[] | DomainConfiguration
 /**
  * {@inheritdoc}
  */
 public function warmUp($cacheDir)
 {
     $domain = $this->ldap->getDomainContext();
     foreach ($this->config->getDomainConfiguration() as $domainConfig) {
         $this->ldap->switchDomain($domainConfig->getDomainName());
         $schemaFactory = $this->ldap->getSchemaFactory();
         $parser = $this->ldap->getSchemaParser();
         $schema = empty($domainConfig->getSchemaName()) ? $domainConfig->getLdapType() : $domainConfig->getSchemaName();
         $ldapObjects = $parser->parseAll($schema);
         $this->cacheAllLdapSchemaObjects($schemaFactory, ...$ldapObjects);
     }
     $this->ldap->switchDomain($domain);
 }
Example #2
0
 /**
  * @param Configuration $config
  * @param Connection\LdapConnectionInterface[] $connections
  */
 public function __construct(Configuration $config, LdapConnectionInterface ...$connections)
 {
     $this->config = $config;
     $this->domains = $config->getDomainConfiguration();
     if (empty($this->domains) && empty($connections)) {
         throw new \RuntimeException("Your configuration must have at least one domain.");
     }
     $this->registerAttributeConverters($config->getAttributeConverters());
     // Pre-populate the connections array. They will be instantiated as needed.
     foreach (array_keys($this->domains) as $domain) {
         $this->connections[$domain] = null;
     }
     $this->addConnection(...$connections);
     $this->context = array_keys($this->domains)[0];
     if (!empty($this->config->getDefaultDomain())) {
         $this->validateDomainName($this->config->getDefaultDomain());
         $this->context = $this->config->getDefaultDomain();
     }
 }