Inheritance: extends ArrayHydrator, use trait HydrateQueryTrait
Ejemplo n.º 1
0
 /**
  * Trigger a LDAP object after creation event.
  *
  * @param AddOperation $operation
  */
 protected function triggerAfterCreationEvent(AddOperation $operation)
 {
     $event = new LdapObjectCreationEvent(Event::LDAP_OBJECT_AFTER_CREATE);
     $event->setData((new ParameterResolver($this->attributes, $this->hydrator->getParameters()))->resolve());
     $event->setContainer($operation->getLocation());
     $event->setDn($operation->getDn());
     $this->dispatcher->dispatch($event);
 }
Ejemplo n.º 2
0
 /**
  * @param OperationHydrator $hydrator
  * @param LdapOperationInterface $operation
  * @return LdapOperationInterface
  */
 protected function hydrateOperation(OperationHydrator $hydrator, LdapOperationInterface $operation)
 {
     if ($this instanceof SchemaAwareInterface) {
         $hydrator->setLdapObjectSchema($this->getLdapObjectSchema());
     }
     if ($this instanceof LdapAwareInterface) {
         $hydrator->setLdapConnection($this->getLdapConnection());
     }
     return $hydrator->hydrateToLdap($operation);
 }
Ejemplo n.º 3
0
 /**
  * @param QueryOperation $operation
  * @param string $hydratorType
  * @param null|LdapObjectSchema $schema
  * @param null|string $alias
  * @return mixed
  */
 protected function getResultsFromLdap(QueryOperation $operation, $hydratorType, $schema = null, $alias = null)
 {
     $hydrator = $this->hydratorFactory->get($hydratorType);
     $hydrator->setLdapConnection($this->ldap);
     $hydrator->setOperationType(AttributeConverterInterface::TYPE_SEARCH_FROM);
     $hydrator->setLdapObjectSchema($schema);
     $hydrator->setSelectedAttributes($this->getAttributesToLdap($operation->getAttributes(), false, $schema, $alias));
     $opHydrator = new OperationHydrator($this->ldap);
     $opHydrator->setAlias($alias);
     $opHydrator->setOrderBy($this->orderBy);
     $opHydrator->setLdapObjectSchema($schema);
     $opHydrator->hydrateToLdap($operation);
     return $hydrator->hydrateAllFromLdap($this->ldap->execute($operation));
 }
Ejemplo n.º 4
0
 /**
  * {@inheritdoc}
  */
 public function toOperation()
 {
     $hydrator = new OperationHydrator();
     $hydrator->setOperationType(AttributeConverterInterface::TYPE_CREATE);
     $operation = new AddOperation($this->dn, $this->attributes);
     $operation->setLocation($this->location);
     return $this->hydrateOperation($hydrator, $operation);
 }
Ejemplo n.º 5
0
 /**
  * Get the LDAP filter formed by this query.
  *
  * @return string
  */
 public function toLdapFilter()
 {
     return $this->hydrator->hydrateToLdap(clone $this->operation)->getFilter();
 }
Ejemplo n.º 6
0
 /**
  * {@inheritdoc}
  */
 public function toOperation()
 {
     $hydrator = new OperationHydrator();
     $hydrator->setOperationType(AttributeConverterInterface::TYPE_MODIFY);
     $operation = new BatchModifyOperation($this->dn, clone $this->batches);
     return $this->hydrateOperation($hydrator, $operation);
 }