setConverterMap() public method

Set the attribute name to attribute converter map.
public setConverterMap ( array $converterMap )
$converterMap array
 function let(LdapConnectionInterface $connection, AddOperation $operation)
 {
     $schema = new LdapObjectSchema('ad', 'user');
     $schema->setAttributeMap(['username' => 'sAMAccountName', 'emailAddress' => 'mail', 'disabled' => 'userAccountControl', 'passwordMustChange' => 'pwdLastSet', 'passwordNeverExpires' => 'userAccountControl', 'trustedForAllDelegation' => 'userAccountControl', 'groups' => 'memberOf']);
     $schema->setConverterMap(['disabled' => 'user_account_control', 'passwordMustChange' => 'password_must_change', 'trustedForAllDelegation' => 'user_account_control', 'passwordNeverExpires' => 'user_account_control', 'groups' => 'group_membership']);
     $schema->setConverterOptions(['user_account_control' => ['uacMap' => ['disabled' => '2', 'passwordNeverExpires' => '65536', 'smartCardRequired' => '262144', 'trustedForAllDelegation' => '524288', 'passwordIsReversible' => '128'], 'defaultValue' => '512'], 'group_membership' => ['groups' => ['to_attribute' => 'member', 'from_attribute' => 'memberOf', 'attribute' => 'sAMAccountName', 'filter' => ['objectClass' => 'group']]]]);
     $this->schema = $schema;
     $connection->getConfig()->willReturn(new DomainConfiguration('foo.bar'));
     $this->beConstructedThrough('getInstance', [$schema, $this->entryTo, AttributeConverterInterface::TYPE_CREATE]);
 }
 function let(LdapConnectionInterface $connection)
 {
     $schema = new LdapObjectSchema('ad', 'user');
     $schema->setAttributeMap(['username' => 'sAMAccountName', 'emailAddress' => 'mail', 'disabled' => 'userAccountControl', 'passwordMustChange' => 'pwdLastSet', 'passwordNeverExpires' => 'userAccountControl', 'trustedForAllDelegation' => 'userAccountControl', 'groups' => 'memberOf']);
     $schema->setConverterMap(['disabled' => 'user_account_control', 'passwordMustChange' => 'password_must_change', 'trustedForAllDelegation' => 'user_account_control', 'passwordNeverExpires' => 'user_account_control', 'groups' => 'group_membership']);
     $schema->setConverterOptions(['user_account_control' => ['uacMap' => ['disabled' => '2', 'passwordNeverExpires' => '65536', 'smartCardRequired' => '262144', 'trustedForAllDelegation' => '524288', 'passwordIsReversible' => '128'], 'defaultValue' => '512'], 'group_membership' => ['groups' => ['to_attribute' => 'member', 'from_attribute' => 'memberOf', 'attribute' => 'sAMAccountName', 'filter' => ['objectClass' => 'group']]]]);
     $this->expectedSearch = new QueryOperation('(&(distinguishedName=cn=foo,dc=foo,dc=bar))', ['userAccountControl']);
     $this->schema = $schema;
     $connection->getConfig()->willReturn(new DomainConfiguration('foo.bar'));
     $connection->getRootDse()->willReturn(new LdapObject(['foo' => 'bar']));
 }
Esempio n. 3
0
 function it_should_convert_values_when_hydrating_to_ldap()
 {
     $schema = new LdapObjectSchema('ad', 'user');
     $schema->setAttributeMap(['foo' => 'bar']);
     $schema->setConverterMap(['foo' => 'bool']);
     $this->setLdapObjectSchema($schema);
     $attributes = $this->objectToLdap;
     $attributes['foo'] = true;
     $this->hydrateToLdap($attributes)->shouldContain('TRUE');
 }
Esempio n. 4
0
 function it_should_query_results_from_multiple_schema_types($connection)
 {
     $foo = new LdapObjectSchema('foo', 'foo');
     $bar = new LdapObjectSchema('foo', 'bar');
     $foo->setFilter(new Comparison('foo', '=', 'bar'));
     $bar->setFilter(new Comparison('bar', '=', 'foo'));
     $map = ['firstName' => 'givenname', 'lastName' => 'sn', 'created' => 'whencreated', 'name' => 'cn'];
     $bar->setAttributeMap($map);
     $bar->setAttributesToSelect(['name', 'created']);
     $bar->setConverterMap(['generalized_time' => ['created']]);
     $foo->setAttributeMap($map);
     $foo->setAttributesToSelect(['firstName', 'lastName']);
     $fb = new FilterBuilder();
     $filter = new OperatorCollection();
     $filter->addLdapObjectSchema($foo);
     $filter->addLdapObjectSchema($bar);
     $filter->add($fb->bAnd($fb->startsWith('foo.firstName', 'J'), $fb->startsWith('bar.name', 'Smith'), $fb->present('lastName')));
     $this->operation->setFilter($filter);
     $this->operation->setAttributes([]);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(foo=bar)(&(givenname=J*)(sn=*)))' && $op->getAttributes() == ['givenname', 'sn'];
     }))->shouldBeCalled()->willReturn($this->ldapEntries);
     $connection->execute(Argument::that(function ($op) {
         return $op->getFilter() == '(&(bar=foo)(&(cn=Smith*)(sn=*)))' && $op->getAttributes() == ['cn', 'whencreated'];
     }))->shouldBeCalled()->willReturn($this->sortEntries);
     $this->getResult()->count()->shouldBeEqualTo(4);
     $this->getArrayResult()->shouldHaveCount(4);
 }