本文整理汇总了PHP中Zend\Ldap\Dn::getRdn方法的典型用法代码示例。如果您正苦于以下问题:PHP Dn::getRdn方法的具体用法?PHP Dn::getRdn怎么用?PHP Dn::getRdn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Ldap\Dn
的用法示例。
在下文中一共展示了Dn::getRdn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Sends all pending changes to the LDAP server
*
* @param Ldap $ldap
* @return Node Provides a fluid interface
* @throws Exception\LdapException
* @trigger pre-delete
* @trigger post-delete
* @trigger pre-add
* @trigger post-add
* @trigger pre-rename
* @trigger post-rename
* @trigger pre-update
* @trigger post-update
*/
public function update(Ldap $ldap = null)
{
if ($ldap !== null) {
$this->attachLdap($ldap);
}
$ldap = $this->getLdap();
if (!($ldap instanceof Ldap)) {
throw new Exception\LdapException(null, 'No LDAP connection available');
}
if ($this->willBeDeleted()) {
if ($ldap->exists($this->dn)) {
$this->triggerEvent('pre-delete');
$ldap->delete($this->dn);
$this->triggerEvent('post-delete');
}
return $this;
}
if ($this->isNew()) {
$this->triggerEvent('pre-add');
$data = $this->getData();
$ldap->add($this->_getDn(), $data);
$this->loadData($data, true);
$this->triggerEvent('post-add');
return $this;
}
$changedData = $this->getChangedData();
if ($this->willBeMoved()) {
$this->triggerEvent('pre-rename');
$recursive = $this->hasChildren();
$ldap->rename($this->dn, $this->newDn, $recursive, false);
foreach ($this->newDn->getRdn() as $key => $value) {
if (array_key_exists($key, $changedData)) {
unset($changedData[$key]);
}
}
$this->dn = $this->newDn;
$this->newDn = null;
$this->triggerEvent('post-rename');
}
if (count($changedData) > 0) {
$this->triggerEvent('pre-update');
$ldap->update($this->_getDn(), $changedData);
$this->triggerEvent('post-update');
}
$this->originalData = $this->currentData;
return $this;
}