Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When trying to use flexiaccess in beta 2, I have following error:
Fatal error: Call to a member function condition() on a non-object in (...)/sites/all/modules/acl/acl.module on line 161
Code looks like that:
$query = db_select('acl', 'acl')
->addField('acl', 'acl_id')
->condition('module', $module)
->condition('name', $name);
The problem is, addField doesn't respect fluid template and returns string with field alias. So the code should look like:
$query = db_select('acl', 'acl')
->condition('module', $module)
->condition('name', $name);
$query->addField('acl', 'acl_id');
Comments
Comment #1
salvisOuch, yes, I intended to use fields().
Fixed in the -dev version (give it up to 12h to be repackaged).
Thank you for the report and analysis!
Comment #2
greg.harveyWhat's the ETA on beta3? Toying with installed -dev, but would rather not... =)
Comment #3
salvisThe difference between BETA2 and the current -dev is this trivial fix, but we're still waiting for someone to confirm that it actually works now. After this the -dev version is ok to use, but there's not enough substance to warrant a new beta.
I've added a note to the BETA2 release notes.
Comment #5
good_man CreditAttribution: good_man commentedI can confirm it, but usually it's better to use assignments:
Comment #6
David_R CreditAttribution: David_R commentedI can confirm it, too.
Everything works well now.
Comment #7
salvisThanks for your comments.
@good_man: "Usually" is not enough to justify an ugly construct. Do you have a more substantial argument?
Comment #8
good_man CreditAttribution: good_man commentedno it's just the way core uses.
Comment #9
salvisThere's a nice usage of
->fields()
in menu.inc, for example.BETA3 is out, BTW...
Comment #10
greg.harvey\o/