/** * 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); }
/** * @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); }
/** * @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)); }
/** * {@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); }
/** * Get the LDAP filter formed by this query. * * @return string */ public function toLdapFilter() { return $this->hydrator->hydrateToLdap(clone $this->operation)->getFilter(); }
/** * {@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); }