Upgraded to the latest releases of entity and entity registrations and now get this error whenever I try to submit a registration:

Fatal error: Call to a member function internalIdentifier() on a non-object in .../sites/all/modules/registration/includes/registration.entity.inc on line 284

Also tried latest dev of both these modules with the same results. What up? Help! Please!

Comments

levelos’s picture

Status: Active » Fixed

You likely have an older version of Entity API than is required.

digitopo’s picture

Using the following version of entity API:

; Information added by drupal.org packaging script on 2012-05-11
version = "7.x-1.0-rc2+2-dev"
core = "7.x"
project = "entity"
datestamp = "1336695251"

which is the latest version available from the project page
http://drupal.org/project/entity

digitopo’s picture

I figured out what the problem was:

Here is the code that the error message is referring to:

// set a default state if not provided
    if (!$this->state || $this->state == -1) {
      $default_state = registration_get_default_state();
      $this->state = $default_state->internalIdentifier();
    }

In my registration states settings, there was no default state checked, so when it tried to process the new registration it could not find a default state to apply.

So this isn't a problem with the entity module, maybe that conditional should be written differently or the user should be forced to select a default state.

The reason I wasn't using a default state is because I deactivated all the registration states, since I don't want to use any of them.

levelos’s picture

Priority: Critical » Normal

I see. How did you manage to deactivate all states? The system requires states, they are not optional, and you must have at least one that's set as the default.

digitopo’s picture

at /admin/structure/registration/registration_states

there is an array of check boxes for each state. I just unchecked them all.

The system requires states, they are not optional, and you must have at least one that's set as the default.

I didn't know this. It makes sense though at least internally on the backend. But you don't necessarily want users to see the states.

Also FYI, to fix the error I just checked the "default" box next to the "confirmed" state, but did not check the "active" check box. I'm pretty sure it's applying the default state despite not being "active" since it showed up after submitting a registration.

levelos’s picture

We may be missing some validation and need better messaging. Hey, it's still beta!

But you don't necessarily want users to see the states.

They won't unless you mark them as unhidden.

Status: Fixed » Closed (fixed)

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

30equals’s picture

Status: Closed (fixed) » Active

I actually got the same problem after installing 7.x-1.0-beta2, i have registration types, and there are actually no states defined... ?
That's why my default state was NULL. Now that i manually created a state and set it as default, saving a registration works...

jerdavis’s picture

Status: Active » Closed (fixed)

Clean install from the development branch had states set correctly. Also wouldn't hurt to use/try the dev branch of entity api. At least as of around nowish.