Duplicate field values in views for a custom entity I have a custom entity. I'm using hook_entity_property_info() to tell views what fields are in my custom entity.

However for some reason I am getting duplicate fields when it comes to views. As in, I go to add a field in a view, and it is listed twice. It's not a problem, but cosmetically it is ugly.

Why would this be?

I am using this as my views controller class:

'views controller class' =&gt; 'EntityDefaultViewsController',


Could that be the problem?

This is the link that is most relevant to what I am doing:

https://www.drupal.org/node/1208874

My hook_entity_property_info():

/**
 * Implements hook_entity_property_info().
 */
function stockinfo_historical_entity_property_info() {
  $info = array();

  $info['stockinfo_historical']['properties']['sid'] = array(
    'label' =&gt; t('SID'),
    'description' =&gt; t('The ID of the stockinfo historical row.'),
    'type' =&gt; 'stockinfo_historical',
    'schema field' =&gt; 'sid',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['symbol'] = array(
    'label' =&gt; t('Symbol'),
    'description' =&gt; t('Symbol of the stock.'),
    'type' =&gt; 'text',
    'schema field' =&gt; 'symbol',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['name'] = array(
    'label' =&gt; t('Company Name'),
    'description' =&gt; t('Name of the company.'),
    'type' =&gt; 'text',
    'schema field' =&gt; 'name',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['date'] = array(
    'label' =&gt; t('Date'),
    'description' =&gt; t('The day this happened on.'),
    'type' =&gt; 'date',
    'schema field' =&gt; 'date',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['stockinfo_historical_high'] = array(
    'label' =&gt; t('High'),
    'description' =&gt; t('The high on this day.'),
    'type' =&gt; 'decimal',
    'schema field' =&gt; 'stockinfo_historical_high',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['stockinfo_historical_low'] = array(
    'label' =&gt; t('Low'),
    'description' =&gt; t('The low on this day.'),
    'type' =&gt; 'decimal',
    'schema field' =&gt; 'stockinfo_historical_low',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['stockinfo_historical_close'] = array(
    'label' =&gt; t('Close'),
    'description' =&gt; t('The close on this day.'),
    'type' =&gt; 'decimal',
    'schema field' =&gt; 'stockinfo_historical_close',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['stockinfo_historical_volume'] = array(
    'label' =&gt; t('Volume'),
    'description' =&gt; t('The volume on this day.'),
    'type' =&gt; 'decimal',
    'schema field' =&gt; 'stockinfo_historical_volume',
    'entity views field' =&gt; TRUE,
  );
  $info['stockinfo_historical']['properties']['stockinfo_historical_adj_close'] = array(
    'label' =&gt; t('Adjusted Close'),
    'description' =&gt; t('The adjusted close on this day.'),
    'type' =&gt; 'decimal',
    'schema field' =&gt; 'stockinfo_historical_adj_close',
    'entity views field' =&gt; TRUE,
  );
  return $info;
}
Setting EntityDefaultViewsController is not really required as entity API sets this by default and yes it does conflict with hook_entity_property_info().

The solution can be found here: https://www.drupal.org/node/1208874 and it is as simple as defining the 'module' property in hook_entity_info().

&lt;?php
/**
 * Implements hook_entity_info().
 */
function entity_test_entity_info() {
  return array(
    'entity_test' =&gt; array(
      'label' =&gt; t('Test Entity'),
      // Entity API needs to know about your module for the views integration to work
      'module' =&gt; 'entity_test',
     ..
?&gt;


Once the 'module' property is defined the entity API will no longer try to guess the property types and follow hook_entity_property_info() implementation.

This same trick also solved errors related to string and array conversions I was having such as:


  strpos() expects parameter 1 to be string, array given in
  entity.property.inc:363