Not sure why, but all the way up to the initial commit of this module, we have had
target_id defined as:
'target_id' => array(
'description' => 'The id of the target entity',
'type' => 'int',
'unsigned' => TRUE,
'not null' => FALSE,
The column accepts NULL as a value, which is legitimate in some corner cases (the Tree module uses this to store roots of the tree, but it already can modify the schema itself), but most of the cases it just hides obscure bugs.
For example in, we have a case of a migration storing NULL values in there incorrectly, which result in:
The target_id => NULL causes all kinds of EntityMalformedExceptions, hinders indexing by Solr and causes this kind of warnings: Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load()
I think we should just consider moving to NOT NULL and this type of issue would have been caught way sooner.
|#3||1569144-target-id-not-null.patch||1.59 KB||Damien Tournoud|