XF 2.2 Dynamic getters in entity class

Earl

Well-known member
let's say I have this content_type column in an entity which allows values like 'thread', 'post', 'resource',

and also I have a column named 'content_id' and it can hold thread_ids, post_ids, or resource_ids

So, I need to set a getter to thread_id, or post_id, or 'resource_id' dynemically.

Is it possible to set getters dynamically?
for an instance, if the content_type = 'resource' is the case, I only need to set the resource_id getter.

if the content_type = 'thread' is the case, I only need to set the thread_id getter.

if the content_type = 'post' is the case, I only need to set the post_id getter.

How do you set up an entity class like that?
 
Back
Top Bottom