dear colleagues! I have query:
$sql = "SELECT node.name,node.node_id,node.lft,(COUNT(prnt.name) - 1) AS depth
FROM nested_category AS node,
nested_category AS prnt
WHERE node.lft BETWEEN prnt.lft AND prnt.rgt
GROUP BY node.name
ORDER BY node.lft";
$item = NodeMenu::findBySql($sql)->all();
I can display node.name like this:
foreach($item as $it =>$i)
{
echo $i->name;
}
The qestion is how can I display depth? When I'm trying to do the same as with node.name:
foreach($item as $it =>$i)
{
echo $i->depth;
}
I get errorException: Array to string conversion. print_r($item); doesn't contain depth. Please help me out, I couldn't find the solution)