public function destroyBeanInstance($instance)
    {

        // load the object manager
        $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

        // load the bean descriptor
        $descriptor = $objectManager->getObjectDescriptors()->get(get_class($instance));

        // invoke the pre-destroy callbacks if we've a session bean
        if ($descriptor instanceof SessionBeanDescriptorInterface) {
            foreach ($descriptor->getPreDestroyCallbacks() as $preDestroyCallback) {
                $instance->$preDestroyCallback();
            }
        }
    }
public function destroyBeanInstance($instance)
    {

        // load the object manager
        $objectManager = $this->getApplication()->search(ObjectManagerInterface::IDENTIFIER);

        // load the bean descriptor
        $descriptor = $objectManager->getObjectDescriptors()->get(get_class($instance));

        // invoke the pre-destroy callbacks if we've a session bean
        if ($descriptor instanceof SessionBeanDescriptorInterface) {
            foreach ($descriptor->getPreDestroyCallbacks() as $preDestroyCallback) {
                $instance->$preDestroyCallback();
            }
        }
    }
public function destroyBeanInstance ( $ instance ) { // load the object manager $ objectManager = $ this -> getApplication ( ) -> search ( ObjectManagerInterface :: IDENTIFIER ) ; // load the bean descriptor $ descriptor = $ objectManager -> getObjectDescriptors ( ) -> get ( get_class ( $ instance ) ) ; // invoke the pre-destroy callbacks if we've a session bean if ( $ descriptor instanceof SessionBeanDescriptorInterface ) { foreach ( $ descriptor -> getPreDestroyCallbacks ( ) as $ preDestroyCallback ) { $ instance -> $ preDestroyCallback ( ) ; } } }
Invokes the bean method with a pre-destroy callback.

@param object $instance The instance to invoke the method

@return void
Invokes the bean method with a pre - destroy callback .