know in what level I am using php function

35 views
Skip to first unread message

Martin Larsson

unread,
Apr 5, 2023, 4:52:55 AM4/5/23
to AtoM Users
hello,

In a hierarchical tree, I've been trying to find out what level I'm currently on.
in  particular if i'm on the last (lowest). is there a php function for this I havent found or so I need to use SQL to do this?

best regards
martin

José Raddaoui

unread,
Apr 11, 2023, 1:47:04 PM4/11/23
to AtoM Users
Hi Martin,

Guessing you are talking about knowing that from a code perspective. There is a PHP method for that called `hasChildren()` on entities with nested set, it just checks the `rgt - lft` difference without hitting the database again. Here an example of its usage:


And its implementation on the information object entity:


Is that what you are looking for?

Best,
Radda.
Reply all
Reply to author
Forward
0 new messages