LdapTools\Object\LdapObject::setBatchCollection PHP Method

setBatchCollection() public method

Sets the BatchCollection.
public setBatchCollection ( BatchCollection $batches )
$batches LdapTools\BatchModify\BatchCollection
    public function setBatchCollection(BatchCollection $batches)
    {
        $this->batches = $batches;
        return $this;
    }

Usage Example

 /**
  * @param LdapObject $ldapObject
  * @param string|null $dn The DN to use for the batch operation to LDAP.
  */
 protected function executeBatchOperation(LdapObject $ldapObject, $dn = null)
 {
     $dn = $dn ?: $ldapObject->get('dn');
     $operation = new BatchModifyOperation($dn, $ldapObject->getBatchCollection());
     $this->hydrateOperation($operation, $ldapObject->getType());
     $this->connection->execute($operation);
     $ldapObject->setBatchCollection(new BatchCollection($ldapObject->get('dn')));
 }