WordPoints / hooks-api

A basic API for hooking into user actions https://github.com/WordPoints/wordpoints/issues/321
GNU General Public License v2.0
0 stars 0 forks source link

What happens when the type of an entity changes? #127

Closed JDGrimes closed 8 years ago

JDGrimes commented 8 years ago

Originally I was going to post this in #126, but I decided that it was really a broader issue that deserved its own ticket.

What happens when the type of an entity changes? For example, the type of a post can change, and that causes the entity type to change.

JDGrimes commented 8 years ago

Perhaps this should really just call the split post types entities into question. Although I wonder if it would ever really make all that much sense to change what type of post a post is. Each post type can have its own taxonomies and metadata, etc. Generally two wouldn't be entirely interchangeable. And if they were, that would probably call into question why exactly two different post types were needed for that use-case. Of course, that's beyond our concerns. But the fact is that it seems like even changing a post's type would be a real edge-case. So perhaps it is better to just consider this an edge-case, period. If the type of an entity can change, that'd generally seem to indicate that probably our entity class's definition is too narrow, and should be widened to include more. Though I suppose it is really impossible for us to know what is out there. But then, that's a bridge that we can burn when we come to it, I think.

JDGrimes commented 8 years ago

But to answer the question, just so that we know what t implications would be, when an entity's type changed, its GUID would change. This would result in the entity no loner matching its previous GUID in the hit logs. In practical terms, this means that it will be treated as an entirely different entity, and therefore double-hits could occur.

Of course, this can also have much broader implications, even changing what events the entity is responsive to.