1

When using nodes, I use the rather good Feeds Import module and all is well with the world. I now need to use an entity as don't need URLS, comments etc so have created one called 'Cars' and have various fields attached to this.

I now need to import 1000 cars but have no clue how to do it? Using nodes this is very simple from csv, xml etc but entity seems to have no such module.

Does anyone know what I need to use to do this? Would I need to create a custom script that connects directly to the mysql and that writes to the fields I created?

1

1 Answer 1

1

it all depends on what functionality your entity provides. are you defining entity yourself or are you using some other module?

anyway simplest way is to create entity manually

$entity = entity_get_controller($entity_type)->create(array('bundle' => $bundle_type));//this could look this way ->create($bundle_type); depending on your constructor 

$entity->your_field['und'] = $value;//assuming you don't use entity translation then language is und

entity_get_controller($entity_type)->save($entity);

in case your controller extends EntityAPIControllerExportable then you could use import/export but if you importing from external source probably custom code would be easier

1
  • 1
    Hi, I used entity construction kit module to create an entity, then added fields to it the same way I would a node. All through the UI. May 5, 2014 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.