Get the schema name set for this domain. If none is set explicitly, it will return the LDAP type name.
public getSchemaName ( ) : string | ||
return | string |
function it_should_switch_to_the_domain_defined_in_the_annotation_when_loading_a_ldap_object($eventArgs, $schema, $ldap, $qb, $query, $entity, $schemaFactory, $reader, $metadata, \ReflectionProperty $rp) { $value = 'foo'; $annotation = new LdapObject(); $ldapObject = new \LdapTools\Object\LdapObject(['foo', 'bar'], ['user'], 'user', 'user'); $metadata->getReflectionProperties()->shouldBeCalled()->willReturn([$rp]); $reader->getPropertyAnnotation($rp, Argument::any())->shouldBeCalled()->willReturn($annotation); $rp->getValue($entity)->shouldBeCalled()->willReturn($value); $schemaFactory->get($this->config->getSchemaName(), $annotation->type)->shouldBeCalled()->willReturn($schema); $schema->getAttributesToSelect()->shouldBeCalled()->willReturn(['foo', 'bar']); $qb->select(['foo', 'bar', 'guid'])->shouldBeCalled()->willReturn($qb); $qb->from($annotation->type)->shouldBeCalled()->willReturn($qb); $qb->where([$annotation->id => $value])->shouldBeCalled()->willReturn($qb); $query->getOneOrNullResult()->shouldBeCalled()->willReturn($ldapObject); $rp->setValue($entity, $ldapObject)->shouldBeCalled(); $domain = 'example.local'; $annotation->domain = $domain; $ldap->switchDomain($domain)->shouldBeCalledTimes(1); $ldap->switchDomain('foo.bar')->shouldBeCalledTimes(1); $this->postLoad($eventArgs); }