Issues

ZF-11968: Allow pre/post add/update/deletion logic to be applied to Zend_Ldap_Node

Issue Type: New Feature Created: 2012-01-04T17:39:41.000+0000 Last Updated: 2012-01-23T16:02:27.000+0000 Status: Resolved Fix version(s): - 1.12.0 (27/Aug/12)

Reporter: Claude Duvergier (cduv) Assignee: Stefan Gehrig (sgehrig) Tags: - Zend_Ldap

Related issues: Attachments:

Description

Zend_Db_Table_Row_Abstract offers the ability to execute some specific logic before and after a Row creation, update and deletion via the following methods: * _preInsert() * _postInsert() * _preUpdate() * _postUpdate() * _preDelete() * _postDelete()

There is no such thing in Zend_Ldap_Node or Zend_Ldap_Node_Abstract. When one have subclassed Zend_Ldap_Node he could want to perform special actions when a LDAP entry/node gets updated (eg. recompute displayName from givenName and surname, password changed notification, etc.).

As Zend_Ldap_Node::update() performs all useful checks before calling the relevant Zend_Ldap methods (add(), (update() or (delete()) it would be fairly easy to add this feature.

+Patch file proposal:+ Here is a patch (based on Zend\Ldap\Node.php r24352) that adds pre/post add/update/rename/delete methods.

<pre class="highlight">
435a436
>                 $this->_preDelete();
436a438
>                 $this->_postDelete();
442a445
>             $this->_preAdd();
443a447
>             $this->_postAdd();
450a455
>             $this->_preRename();
451a457
>             $this->_postRename();
460a467
>             $this->_preUpdate();
461a469
>             $this->_postUpdate();
464a473,552
>     }
> 
>     /**
>     * Allows pre-add logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _preAdd ()
>     {
>     }
> 
>     /**
>     * Allows post-add logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _postAdd ()
>     {
>     }
> 
>     /**
>     * Allows pre-update logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _preUpdate ()
>     {
>     }
> 
>     /**
>     * Allows post-update logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _postUpdate ()
>     {
>     }
> 
>     /**
>     * Allows pre-rename logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _preRename ()
>     {
>     }
> 
>     /**
>     * Allows post-rename logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _postRename ()
>     {
>     }
> 
>     /**
>     * Allows pre-delete logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _preDelete ()
>     {
>     }
> 
>     /**
>     * Allows post-delete logic to be applied to node.
>     * Subclasses may override this method.
>     *
>     * @return void
>     */
>     protected function _postDelete ()
>     {

Comments

Posted by Claude Duvergier (cduv) on 2012-01-04T17:41:33.000+0000

Minor typos

Posted by Stefan Gehrig (sgehrig) on 2012-01-21T14:04:07.000+0000

Fixed in ZF1 trunk and in 1.11 release branch. Patch implemented as provided by the OP

Posted by Stefan Gehrig (sgehrig) on 2012-01-21T14:34:56.000+0000

Also fixed in ZF2 - pull request https://github.com/zendframework/zf2/pull/745

Posted by Claude Duvergier (cduv) on 2012-01-23T08:25:51.000+0000

Thanks

Posted by Matthew Weier O'Phinney (matthew) on 2012-01-23T14:44:53.000+0000

Stefan -- please back this out of the 1.11 release branch. New features should not be added within a bugfix release, only with new minor/major releases. We can release this with 1.12.0.

Posted by Matthew Weier O'Phinney (matthew) on 2012-01-23T14:46:49.000+0000

Stefan -- also, for ZF2, this functionality should be implemented using an EventManager instance instead. If you want some ideas on how that might be accomplished, ping me.

Posted by Matthew Weier O'Phinney (matthew) on 2012-01-23T14:47:19.000+0000

Re-opening, as the functionality needs to be backed out of the 1.11 release branch, and targetted for the 1.12.0 release.

Posted by Stefan Gehrig (sgehrig) on 2012-01-23T15:51:36.000+0000

removed fix from the 1.11 branch

Posted by Matthew Weier O'Phinney (matthew) on 2012-01-23T16:02:27.000+0000

Thanks, Stefan. If you need any assistance with the ZF2 version of the patch, let me know.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts