Fix issues with TreeBehavior and nested deletes.
Fix issues with TreeBehavior and nested deletes.

Fixes #3481

elboletaire/cakephp,tenkoma/cakephp,khoimt/cakephp-study,burriko/cakephp,khoimt/cakephp-study,web-player/cakephp,kumamidori/cakephp,thinkingmedia/cakephp,jerems02/cakephp,eboominathan/cakephp,garethellis36/cakephp,Balachan27/cakephp,elboletaire/cakephp,ADmad/cakephp,tgr0ss/cakephp,erikfig/cakephp,tenkoma/cakephp,jeffblack360/cakephp,HavokInspiration/cakephp,HavokInspiration/cakephp,nrother/cakephp,jeffblack360/cakephp,CakeDC/cakephp,davidyell/cakephp,et304383/passbolt_api,tenkoma/cakephp,ADmad/cakephp,ADmad/cakephp,tisu2tisu/cakephp,timhoeppner/cakephp,pbaire/cakephp,jjj117/cakephp,eryw/cakephp,elboletaire/cakephp,burriko/cakephp,HavokInspiration/cakephp,Phillaf/cakephp,dakota/cakephp,tgr0ss/cakephp,justinyost/cakephp,kumamidori/cakephp,nrother/cakephp,yinhe007/cakephp,petteyg/cakephp,CVO-Technologies/cakephp,web-player/cakephp,michaelze/cakephp,justinyost/cakephp,dakota/cakephp,petteyg/cakephp,jjj117/cakephp,akintoey/cakephp,cakephp-fr/cakephp,cakephp/cakephp,eboominathan/cakephp,michaelze/cakephp,dkarvounaris/cakephp,petteyg/cakephp,et304383/passbolt_api,ndm2/cakephp,et304383/passbolt_api,adopico/cakephp,yinhe007/cakephp,garethellis36/cakephp,mvdriel/cakephp,et304383/passbolt_api,CakeDC/cakephp,cakephp/cakephp,Phillaf/cakephp,mvdriel/cakephp,eryw/cakephp,jerems02/cakephp,dkarvounaris/cakephp,justinyost/cakephp,thinkingmedia/cakephp,CakeDC/cakephp,petteyg/cakephp,eboominathan/cakephp,davidyell/cakephp,davidyell/cakephp,gmponos/cakephp,ionas/cakephp,tenkoma/cakephp,Balachan27/cakephp,berrygoudswaard/cakephp,khoimt/cakephp-study,ionas/cakephp,cakephp-fr/cakephp,erikfig/cakephp,michaelze/cakephp,adopico/cakephp,eryw/cakephp,CakeDC/cakephp,burriko/cakephp,dkarvounaris/cakephp,erikfig/cakephp,nrother/cakephp,berrygoudswaard/cakephp,bravo-kernel/cakephp,cakephp/cakephp,tisu2tisu/cakephp,gmponos/cakephp,et304383/passbolt_api,jerems02/cakephp,gmponos/cakephp,bravo-kernel/cakephp,garethellis36/cakephp,bravo-kernel/cakephp,thinkingmedia/cakephp,Balachan27/cakephp,cakephp-fr/cakephp,dakota/cakephp,timhoeppner/cakephp,cakephp/cakephp,ndm2/cakephp,dakota/cakephp,ndm2/cakephp,tgr0ss/cakephp,tisu2tisu/cakephp,adopico/cakephp,web-player/cakephp,mvdriel/cakephp,CVO-Technologies/cakephp,pbaire/cakephp,jjj117/cakephp,mvdriel/cakephp,CVO-Technologies/cakephp,ADmad/cakephp,yinhe007/cakephp,pbaire/cakephp,akintoey/cakephp,timhoeppner/cakephp,berrygoudswaard/cakephp,kumamidori/cakephp,jeffblack360/cakephp,akintoey/cakephp,Phillaf/cakephp,ndm2/cakephp,ionas/cakephp,garethellis36/cakephp