Skip to content

Magento 2 problems of getting storeIds, categoryIds and tags

I’m studying Magento 2 and I am stuck on one thing.

I write a Blog module, which contains Posts and Categories. Post entity should have such fields as UrlKey, Title, Content, Status, StoreIds, CategoryIds, Tags, CreatedAt, UpdatedAt. 
StoreIds is an array of store Ids where a post is available;
CategoryIds is an array of blog category Ids related to a given post;
Tags is an array of tag names related to a given post.

Also, all entities should be described as Api data interfaces.
I have made admin part for Categories, but for Posts I don’t understand how should I keep StoreIds, CategoryIds and Tags, and in which way should I take them from DB. As I see in magento cms module, I should add some methods in ResourseModel and Collection. but what methods and how?

I will be really appreciated if you help me!

Thank you!