Class name must be a valid object or a string in /home/andy/d7sandbox/drupal/includes/common.inc on line 7394

(may be specifically when trying to enable er and er_ui at once; looks like er is enabled, er_ui is not. Attempting to enable er_ui again works.)

Comments

usonian’s picture

Title: PHP fatal error on module enable » PHP fatal error on er_ui module enable
usonian’s picture

Status: Active » Fixed

Caused by bad schema definition

Status: Fixed » Closed (fixed)

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

e5sego’s picture

Status: Closed (fixed) » Active

I run into this error again with the fixed version (double-checked fixes from http://drupalcode.org/project/er.git/commitdiff/9dbdb8e348d1d53698effd41... are in). Same error-massage as above, and no er_* tables found in database.

Drupal 7 running on php 5.2.17 and mysql 5.0.32

soyarma’s picture

Latest dev still has this issue

soyarma’s picture

It does appear to be a bad schema def. The tables are not created. Going to try to fix it and hope I get it right.

robloach’s picture

I tested er_schema() on another module, and the tables were created. I see both er_definition and er_role tables... Would it be the hook_entity_info() definition?

webankit’s picture

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'unitinga_spicdemo.er_definition' doesn't exist: SELECT base.did AS did, base.machine_name AS machine_name, base.name AS name, base.description AS description, base.party_from_type AS party_from_type, base.party_to_type AS party_to_type, base.party_from_bundle AS party_from_bundle, base.party_to_bundle AS party_to_bundle, base.party_from_label AS party_from_label, base.party_to_label AS party_to_label, base.party_from_rid AS party_from_rid, base.party_to_rid AS party_to_rid, base.formatter_from AS formatter_from, base.formatter_to AS formatter_to FROM {er_definition} base; Array ( ) in DrupalDefaultEntityController->load() (line 196 of /home2/unitinga/public_html/spicmacay/demo/includes/entity.inc).

acrazyanimal’s picture

subscribing - I see this issue as well. Just downloaded the current dev.

Note: I tried enabling the er and er_ui at the same time and got a php class error. Then enabled each one at a time. I cleared caches to get the 'Entity Relationships' section to show up under structure. I was able to configure which entities were er enabled however when just browsing to /admin/structure/er or /admin/structure/er/roles I received the error displayed in the above comment. I'm guessing that the database tables were not installed properly due to the initial error. I disabled both modules and checked the uninstall section, but neither module appears. Trying to re-enable I get the same initial class errors:

Fatal error: Class name must be a valid object or a string in ...../common.inc on line 7508
...
...
- er_definition_load_multiple( $dids = ???, $conditions = ??? ) ../er.module:595
- entity_load( $entity_type = 'er_definition', $ids = array (), $conditions = array (), $reset = ??? ) ../er.module:158
- entity_get_controller( $entity_type = 'er_definition' ) ../common.inc:7475

Variables in local scope (#16)
$class = null
$controllers =&array empty
$entity_type =string 'er_definition' (length=13)
$type_info =null

Not sure if that helps without much more context? Its all I got.

wilco’s picture

Issue summary: View changes

Actually, this is caused by a poorly formatted .info file in the module. Remove all the files[] lines. None of those are required, but mostly, the er.theme.inc is assuming its a class and trying to instantiate it as such.