I'm declaring an entity that's using EntityAPIController.
I'm also declaring all of my properties in $module.info.inc.
However, entity_entity_property_info() has this code

  // Add in info about entities provided by the CRUD API.
  foreach (entity_crud_get_info() as $type => $info) {
    $info += array('metadata controller class' => 'EntityDefaultMetadataController');
    if ($info['metadata controller class']) {
      $controller = new $info['metadata controller class']($type);
      $items += $controller->entityPropertyInfo();
    }
  }

So it's auto-generating the properties even though I'm providing them myself.
So for every property I get duplicate data in the array (for example, 'type' => 'integer' becomes 'type' => array('integer', 'integer')), which breaks everything.
I specified 'metadata controller class' => '' in my entity info and that fixed it, but I think the code should be less forceful about doing its own thing.
So, maybe we can add a check to see if the module already provides property info?

CommentFileSizeAuthor
#4 entity_info_controller.patch905 bytesfago

Comments

wesnick’s picture

subscribe

fago’s picture

Usually, I've just overridden the default controller and work on top of the defaults. But well, the defaults aren't so super-useful anyway.

>So, maybe we can add a check to see if the module already provides property info?
Sounds good, patch welcome ;)

fago’s picture

Title: The module is a bit too enthusiastic about auto-generating property info » Only auto-generating property info if there is none yet.
Priority: Normal » Minor

I guess, best we just check whether the module implements the hook itself.

fago’s picture

Status: Active » Needs review
StatusFileSize
new905 bytes

so what about that?

bojanz’s picture

Status: Needs review » Reviewed & tested by the community

Sounds good.

fago’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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