Typo3 Extbase: Object not saved

Recently I stumbled upon a nasty problem with Typo3’s Extbase. The instance of an object was not updated, but as usual (for Flow/Extbase, that is) there were no exceptions, no log entries, no hints… Extbase just silently refused to save the object. Great!

After debugging through the code once more (my number 1 source of information regarding Extbase nowadays), I found that 1 of 80 columns of the related table was missing in the TCA array! How dare it! After adding it, everything was working as expected.

The core problem: when fetching the object from the repository, Extbase only populates those class members that are configured in the TCA (which in Extbase will be the DataMap later on). This also means that the class member I forgot in the TCA was missing! Then I used a Setter to set a the mentioned missing value, which added the class member.

Extbase uses spl_object_hash() to keep track of the objects during a request. Of course, due to the missing member, the existing object and the to be updated object had different hashes … got it? Yeah…

I really wished Extbase would communicate more with the developer. Just silently refusing to do stuff is not ok, in my opinion.