/** * {@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); }
/** * @param LdapObjectAnnotation $annotation * @return array */ protected function getLdapAttributesToSelect(LdapObjectAnnotation $annotation) { $attributes = $annotation->attributes; if (empty($attributes)) { $schemaFactory = $this->ldap->getSchemaFactory(); $schema = $schemaFactory->get($this->ldap->getConnection()->getConfig()->getSchemaName(), $annotation->type); $attributes = $schema->getAttributesToSelect(); } if (!in_array($annotation->id, $attributes)) { $attributes[] = $annotation->id; } return $attributes; }
function let(Reader $reader, LdapManager $ldap, LifecycleEventArgs $eventArgs, ObjectManager $om, ClassMetadata $metadata, LdapObjectSchemaFactory $schemaFactory, LdapConnectionInterface $connection, LdapObjectSchema $schema, LdapQueryBuilder $qb, LdapQuery $query, $entity) { $rc = new \ReflectionClass('Doctrine\\Common\\Persistence\\Event\\LifecycleEventArgs'); if ($rc->hasMethod('getObjectManager')) { $eventArgs->getObjectManager()->willReturn($om); $eventArgs->getObject()->willReturn($entity); } else { $eventArgs->getEntityManager()->willReturn($om); $eventArgs->getEntity()->willReturn($entity); } $om->getClassMetadata(Argument::any())->willReturn($metadata); $this->config = new DomainConfiguration('foo.bar'); $connection->getConfig()->willReturn($this->config); $ldap->getDomainContext()->willReturn('foo.bar'); $ldap->getSchemaFactory()->willReturn($schemaFactory); $ldap->getConnection()->willReturn($connection); $ldap->buildLdapQuery()->willReturn($qb); $qb->getLdapQuery()->willReturn($query); $this->beConstructedWith($reader, $ldap); }