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

salvis’s picture

Status: Active » Fixed

Ouch, 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!

greg.harvey’s picture

What's the ETA on beta3? Toying with installed -dev, but would rather not... =)

salvis’s picture

The 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.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

good_man’s picture

Status: Closed (fixed) » Needs review

I can confirm it, but usually it's better to use assignments:

  $query = db_select('acl', 'acl');
  $query->addField('acl', 'acl_id');
  $query
    ->condition('module', $module)
    ->condition('name', $name);
David_R’s picture

I can confirm it, too.
Everything works well now.

salvis’s picture

Thanks for your comments.

@good_man: "Usually" is not enough to justify an ugly construct. Do you have a more substantial argument?

good_man’s picture

no it's just the way core uses.

salvis’s picture

Status: Needs review » Fixed

There's a nice usage of ->fields() in menu.inc, for example.

BETA3 is out, BTW...

greg.harvey’s picture

BETA3 is out, BTW...

\o/

Status: Fixed » Closed (fixed)
Issue tags: -fatal error, -db_select, -addfield

Automatically closed -- issue fixed for 2 weeks with no activity.