Log message #4141585

# At Username Text
# May 16th, 19:01 admad @phantomwatson I'll look into this later and if there isn't a simpler way will add an option to the behaviour to prevent deletion of nodes with children
# May 16th, 19:00 phantomwatson Cool. Thanks for confirming that for me.
# May 16th, 18:59 admad So overriding table's delete would be easiest option for now
# May 16th, 18:58 admad Hmm right, while the transaction is still running it's not possible to check if a node has children since the behaviour has deleted them
# May 16th, 18:58 phantomwatson It prints out the content of the view block named "script".
# May 16th, 18:58 rightscoreanalysis the book's explanation isn't clear to me
# May 16th, 18:58 rightscoreanalysis can anyone tell me what this does: <?= $this->fetch('script') ?>
# May 16th, 18:53 phantomwatson I'm not sure if I'm looking at it wrong, or if the behavior isn't behaving (heh) as intended, or what. Thought it was worth bringing up in here and getting the support channel's insight.
# May 16th, 18:53 saeideng :+1:
# May 16th, 18:53 saeideng >the issue is with my docker container lol :|
# May 16th, 18:52 phantomwatson In my testing, I'm calling `$event->stopPropagation();` and returning `false`, and it appears to not be working. By the time `FooTable::beforeDelete()` is called, the child records have already been deleted.
# May 16th, 18:52 pmoraes the issue is with my docker container lol
# May 16th, 18:52 pmoraes I found the issue
# May 16th, 18:51 saeideng @pmoraes gist your code if you have problem with flash
# May 16th, 18:51 admad @phantomwatson either that or returning false, don't remember exactly right noe
# May 16th, 18:50 phantomwatson You mean with `$event->stopPropagation();`?
# May 16th, 18:50 admad @phantomwatson doesn't matter if the behaviour deletes them first. The transaction is still open so just stop the event from table and cause a revert
# May 16th, 18:43 rightscoreanalysis can i use the css and script helper to include an entire folder rather than individual files
# May 16th, 18:40 slackebot new behavior that extends TreeBehavior and overloads `TreeBehavior::beforeDelete()` to handle this logic?
# May 16th, 18:40 phantomwatson I'd like to set up a `beforeDelete()` callback for a tree-structured table that prevents the deleting of a record if it has children. But `TreeBehavior::beforeDelete()` is invoked and deletes all of a record's children _before_ the table's `beforeDelete()` is invoked. Is my instinct right that I'd need to overload `FooTable::delete()` and put the "has children" check in _there_ to accomplish this instead of using a callback? Or make a
# May 16th, 17:04 Diego_ $saved = $this->_associations->saveParents() return true :/
# May 16th, 16:53 jeremyharris Also, you don't need the reference (and$pagamento) in the loop, and don't need the unset
# May 16th, 16:52 jeremyharris You might have to add some temporary debug statements here to figure out what's going on: https://api.cakephp.org/3.5/source-class-Cake.ORM.Table.html#1773-1838
# May 16th, 16:52 Diego_ there are a debug before save and after save
# May 16th, 16:51 jeremyharris In the paste bin you sent there are
# May 16th, 16:51 Diego_ the debug before save shows the dirty fields, debug after the save there are no dirty fields for the main entity
# May 16th, 16:50 jeremyharris Nm, has to be committed to be success
# May 16th, 16:50 Diego_ commited
# May 16th, 16:50 jeremyharris In the sql log, is the transaction rolled back or committed?
# May 16th, 16:49 jeremyharris Diego I'm confused, you said recibo saves but the entity looks dirty still
# May 16th, 16:48 pmoraes my controller and views are baked FYI lol
# May 16th, 16:48 pmoraes yes I have
# May 16th, 16:48 Diego_ https://pastebin.com/RZ7nyQNs
# May 16th, 16:47 flavius you have the same structure like me, Flash -> flash -> 0
# May 16th, 16:47 pmoraes really strange my issue
# May 16th, 16:47 pmoraes lol
# May 16th, 16:47 pmoraes I'm setting up a new project to test it
# May 16th, 16:47 pmoraes I already did too
# May 16th, 16:46 pmoraes yes
# May 16th, 16:46 flavius debug there
# May 16th, 16:46 pmoraes when it redirect, It seems it lost the flash key. Then I just have Flash.0 instead of Flash.flash.0