You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I want to touch the timestamp of a nested Model it looses it's depth.
I have a nested Page model that has a relationship with a Content model.
When I update the Content model I want to touch the updated_at timestamp of the Page model.
This all works fine with protected $touches = ['page']; in the Content model, but as a bonus I get a set of extra queries that also set the depth off the Page model to zero.
-
UPDATE `contents` set `fields` = '{\"leader\":[{\"file\":\"2\",\"description\":\"\"}],\"about_titel\":\"\",\"about_tekst_1\":\"\",\"about_tekst_2\":\"\",\"contact_titel\":\"\",\"contact_tekst\":\"\"}', `updated_at` = '2016-09-29 23:52:45' WHERE `id` = '129'
UPDATE `pages` set `updated_at` = '2016-09-29 23:52:45' WHERE `pages`.`id` = '118'
SELECT * FROM `pages` WHERE `pages`.`id` = '118' LIMIT 1
SELECT * FROM `pages` WHERE `pages`.`id` = '118' LIMIT 1
SELECT max(`rgt`) as aggregate FROM `pages`
SELECT * FROM `pages` WHERE `pages`.`id` = '118' LIMIT 1
UPDATE `pages` set `depth` = '0', `updated_at` = '2016-09-29 23:52:45' WHERE `id` = '118' ORDER BY `pages`.`lft` ASC
1.060 m
Is there some kind of event that triggers these last 5 queries?
The text was updated successfully, but these errors were encountered:
I've had a quick look at this, and I think it's caused by the saved event being caught in Baum\Node, which calls moveToNewParent then setDepth. It's obviously a bug, as we shouldn't be updating anything 'node-related' just because a time stamp changes.
I'll need to look in this more and implement a fix.
I ran across this issue, too, and for anyone else needing a fix, I changed the default $moveToNewParentId from null to false and it seemed to solve it for me. This is line 67 in
src/Baum/Node.php.
When I want to touch the timestamp of a nested Model it looses it's depth.
I have a nested Page model that has a relationship with a Content model.
When I update the Content model I want to touch the updated_at timestamp of the Page model.
This all works fine with
protected $touches = ['page'];
in the Content model, but as a bonus I get a set of extra queries that also set the depth off the Page model to zero.Is there some kind of event that triggers these last 5 queries?
The text was updated successfully, but these errors were encountered: