Closed (fixed)
Project:
Entity API
Version:
7.x-1.x-dev
Component:
Entity CRUD API - main
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Nov 2010 at 09:33 UTC
Updated:
4 Dec 2010 at 20:50 UTC
This happens with the message module, and I don't understand yet why
1) Enable the message module
2) Run this code:
$message_type = message_type_create('create_node');
$message_type->save();
// TODO: Add the message realm field to the bundle. This should be done by
// the message module itself, but I haven't found the right place to do it
// yet.
message_add_field_message_realm('create_node');
$message = message_create('create_node', array());
$message->save(); // This is not saved in the DB.
When I tried to save it myself it writes the record.
$message = message_create('create_node', array());
drupal_write_record('message', $message);
Comments
Comment #1
amitaibu> Run this code:
You can run this code via message.test
Comment #2
fagoSounds strange. 'll have a closer look at it.
Comment #3
fagook, I just tried it and with some debugging I found out an exception is thrown during saving:
The problem though was, that the entity CRUD API has used an deprecated way of rolling back the transaction. I've just improved that to use the recent way of doing so - just like core - such that those exceptions are thrown + logged to the watchdog now.
I think, the best place for this would be
hook_message_type_insert(). Though I've to dive into the realms now.Comment #4
amitaibuOk, now I'm getting the exception, thanks for the quick fix.
But this shows another issue -- the mid is a serial key, so why is it NULL?
> I think, the best place for this would be hook_message_type_insert().
It sounds right, but I'm getting some violation error. I'll also have to dig in :)
Comment #5
amitaibu> But this shows another issue -- the mid is a serial key, so why is it NULL?
Erase that, the above is referring to the realm field. Sorry for the confusion.