ORM - solve problem

I want to use ORM database model.

I have 3 types of users and every type have different form to add,save posts, limit fields.

What will be the best solution to create model to cover all users?

For example, i have table with this column:

post_id,

post_name,

post_text,

post_tags,

post_extra,

post_admin,

post_date

User admin should have access to create,update all fields, because he see full form to update.

User moderator should have acces to create,update all fields, except post_admin, because he don't see this field in his form.

User normal should have access only to fields name, text and tags, because there are only fields, that he see in his form.

When i limit only forms, and i try to create model, i see error, because some fields are missing and to create, update i need to send all fields, that are in database.

You can use the ACL to implement what users can make: * https://docs.phalconphp.com/en/latest/reference/acl.html

And the forms builder to enable/disable certain fields when needed: * https://docs.phalconphp.com/en/latest/reference/forms.html



2.8k

But if i disable certain field in form, model don't allow me to create entry, because in model, we need to put all fields before we can creat() and instert data into database. As i write abowe, some users don't see some fields, so it's impossible by them to add post because all fields are required.