This started out with a Fatal error: Call to a member function label() on array when I tried to visit the url for a single entity defined using Entity API. It turns out that this is happening because EntityAPIController->query, which is supposed to return Entity objects, is instead returning arrays that look like they have been built with PDO::FETCH_BOTH mode.

I was going to post this issue, but just now I figured out that this is what happens when you put your entity's "entity class" in a file that is not included in your .info file. So here is the first bit of my hook_entity_info():

function atc_entity_info() {
  $info = array(
    'atc_report' => array(
      'label' => t('Activity report'),
      'plural label' => t('Activity reports'),
      'entity class' => 'AtcActivityEntity',
      'controller class' => 'EntityAPIController',
      'extra fields controller class' => 'EntityDefaultExtraFieldsController',
      'base table' => 'atc_report',

And the `Class AtcActivityEntity extends Entity {` lives in an include file that is not listed in .info. Once I listed that file in .info, everything worked. But, in case anyone else has this trouble, I guess I can submit this support request as already closed.

CommentFileSizeAuthor
Screen Shot 2016-12-10 at 4.09.27 PM.png88.26 KBdnotes
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dnotes created an issue. See original summary.

Status: Fixed » Closed (fixed)

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