EntityMetadataWrapper: Be careful with empty / non-existing entities! (aka EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format.)

entity_metadata_wrapper() is an extremely helpful helper :)
Anyway today I found out something dangerous:

Be careful with constructs like this:

  1. $term = taxonomy_term_load($tid);
  2. $term_wrapper = entity_metadata_wrapper('taxonomy_term', $term);

Drupal Commerce: "No line items found" Problem on invoices in some circumstances

There is a big issue with invoices generated in some circumstances, for example on anonymous orders. Sometimes the line items are not included in this view and you just see the message "No line items found"!

But this is not a commerce_billy_mail.module or commerce_billy.module bug. It's a problem within the entity permission concept, that leads to this.

Linktipp: Drupal Modul mit Entities erstellen

Der heutige Linktipp enthält eine ausführliche Anleitung zum Erstellen eigener Module in Drupal 7, die Entities nutzen!