There was an error in 1.1 version for D7 (maybe it is already fixed in repository). I am not comfortable with D7 API (only D6), so may be I am wrong somewhere, please check me.
First issue:
function _taxonomy_menu_get_terms($vid) {
$result = db_select('taxonomy_term_data', 'td')
->condition('vid', $vid)
->addField('td', 'tid')
->execute();
return $result->fetchAll();
}
addField returns new field alias, not SelectQuery object, so we get an error here (PHP says that could not do ->execute() on non-object). Also this function is recommended to use just when we need to know assigned alias, otherwise we could use ->fields() (http://api.drupal.org/api/drupal/includes--database--select.inc/function...).
My variant:
function _taxonomy_menu_get_terms($vid) {
$result = db_select('taxonomy_term_data', 'td')
->condition('vid', $vid)
->fields('td', array('tid'))
->execute();
return $result->fetchAll();
}
2) Issue like previous one in the same file:
function _taxonomy_menu_get_vid_by_tid($tids) {
if ($tids) {
$result = db_select('term_data')
->condition('tid', $tids, 'IN')
->addField('vid')
->distinct()
->execute();
$vids = array();
return $result->fetchAllAssoc('vid');
}
}
There is ->addField()->something. And maybe one more error: addField requires 2 arguments (table_alias, field), so may be right code looks like:
function _taxonomy_menu_get_vid_by_tid($tids) {
if ($tids) {
$result = db_select('term_data')
->condition('tid', $tids, 'IN')
->fields('term_data', array('vid'))
->distinct()
->execute();
$vids = array();
return $result->fetchAllAssoc('vid');
}
}
But in that case I am not so sure.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | taxonomy_menu_database_inc_fix-1175470-0.patch | 771 bytes | Aracon |
Comments
Comment #1
dstol@Aracon, mind submitting a patch for this? It's kinda hard to follow.
Comment #2
Aracon commentedI'm not very experienced in creating pathes for Drupal and working with git, so I hope I made all properly.
Comment #3
Aracon commentedComment #4
frank ralf commentedI got the same (or similar) error with a Drupal 7.4 install. The patch seems to have fixed the problem.
Frank
Comment #5
frank ralf commentedI applied the patch successfully to the 7.x-1.2 version (which seems to be identical to the dev version, unfortunately both don't seem to be available via CVS which makes creating patches a bit cumbersome).
However, I still get the error message described at #670346: Undefined index/property notices.
Comment #6
dstolThanks! Committed in 7.x-1.x. http://drupalcode.org/project/taxonomy_menu.git/commit/9967f65
Comment #8
SlyK commentedSo this fix is still not released :(
Got another error: function _taxonomy_menu_get_terms() doesn't work as designed, because fetchAll() will return array of OBJECTS. And this leads to error in taxonomy_menu_path_default() on implode function. Example of bad return value:
Easy fix for this will be replace
with
Comment #9
barrett commentedSlyK, the issue reported by the poster is fixed in the current 7.x-1.x-dev version. If you're still experiencing the other problem, please open a new issue.