protected function addOperation($dn, $batchType)
{
$collection = new BatchCollection($dn);
$valueDn = $this->getDn();
// The DN is unknown in the case of an add, as value/parameter resolution most occur first. If there is a better
// way to do this I'm not sure what it would be. The batch will resolve closures when producing an array to ldap.
if ($this->getOperationType() == AttributeConverterInterface::TYPE_CREATE) {
/** @var AddOperation $parentOp */
$parentOp = $this->getOperation();
$valueDn = function () use($parentOp) {
return $parentOp->getDn();
};
}
$collection->add(new Batch($batchType, $this->getOptionsArray()['to_attribute'], $valueDn));
$operation = new BatchModifyOperation($dn, $collection);
$this->operation->addPostOperation($operation);
}