Entities tend to get serialized in various places : cache, forms...
ConfigEntities, being more business oriented, additionally tend to get more business specific helper methods, possibly relying on internal properties / derived data / external services, other than their raw data, and which you usually don't want to serialize.
Nice thing is, ConfigEntities have a pretty straightforward serialization format: the exported properties that end up in their CMI file...
We had to do this for Field / FieldInstance entities, that fall exactly in this case above, but the code is pretty agnostic and might make sense for all ConfigEntity types.
(since then, duplicated that same code in EntityFormDisplay - leaving the symmetrical EntityViewDisplay out).
Basically, serialize to the raw array returned by getExportProperties() (as if it was going to CMI), and unserialize by passing this array to __construct() (just as if it was read from config). Same format, different storage.
Patch once I get a node id.
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 94,916 pass(es), 295 fail(s), and 75 exception(s).
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 94,920 pass(es), 290 fail(s), and 76 exception(s).
FAILED: [[SimpleTest]]: [PHP 5.4 MySQL] 90,326 pass(es), 308 fail(s), and 114 exception(s).