Issue Bug Closed

#15717t3lib_pageSelect::getMenu() needs more database columns than it specifies

Neil Bertram 02/24/06, 10:59 updated 08/12/06, 14:17

Description

In the past I only specified the actual fields I needed to the $fields parameter of getMenu, and hadn’t had any issues. Testing some of my extensions against 4.0.0b3 has caused getMenu() to only return a single top-level sysfolder when I specify pid 0, rather than the entire visible root level tree.

I discovered by passing it ‘*’ instead of a limited set of fields I got the correct result again, and noticed the comment:
// $row MUST have “uid”, “pid”, “doktype”, “mount_pid”, “mount_pid_ol” fields in it

In this particular case $fields = uid,doktype,title so I added mount_pid and mount_pid_ol, but I still only got the single sysfolder.

I believe it’s an issue with mountpoints (I have none on this site), and that getMenu() actually requires more fields than it specifies. This is actually really annoying, because I’d like to be able to just select the fields I need, especially since my plugin is feeding the tree out as XML and therefore I want to minimise the fields being transferred.

I suggest that getMenu() automatically adds any additional fields that it needs internally to the SELECT query, but unsets them from the result row that gets returned.

Code that returned the wrong result:

$branch = $sysPageObj->getMenu(0, ‘uid,title,doktype’);

Code that returned the right result:
$branch = $sysPageObj->getMenu(0, ‘*’);
reset($branch);
while (list($key) = each($branch)) {
$branch[$key] = array(‘uid’ => $branch[$key][‘uid’], ‘doktype’ => $branch[$key][‘doktype’], ‘title’ => $branch[$key][‘title’]);
}

(issue imported from #M2688)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.