0

I'm playing with Entity Construction Kit (ECK) on a Drupal 7 site. In a custom module I need to add, update and get ECK record.

By admin panel I created my entity "company" and his bundle "company". In my module I already built add and get method for the entity record (methods are working).

But how can I update a specific record ?

Thanks.

  • Are you talking about services or web enviroment? – vgoradiya Aug 11 '15 at 10:25
  • I'm not sure to understand your comment... but I'm in a custom module so it's the web environment of Drupal. – Promo Aug 11 '15 at 10:51
0

After thousands of research, according to the page Creating and Modifying Entities this is the way to update an entity :

$entity = entity_load_single('entity_name', array(entity_id));
$entity->title = 'new name';
$entity->save();

This will load the entity 'entity_name' with the id 'entity_id', then the title will be replace by 'new name'.

I hope its help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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