OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums OroCRM OroCRM – Programming Questions Best practice for custom entity extending contact AND user

This topic contains 2 replies, has 2 voices, and was last updated by Spurgeon Spurgeon 9 months ago.

  • Creator
    Topic
  • #37643
    Spurgeon
    Spurgeon
    Participant

    Hi,

    For our usecase, we wish to have a self help option for our contacts (selected types), where they can login them selves with their own username and password and maintain their personal info which they are allowed to edit.

    Since the native OroUser entity has the login / password management capability (which the contact entity apparently doesnt have), is it possible to combine a contact and user entities and create a custom entity that can have the attributes of both the parent entities?

    If so, which would be the best approach to do this? Through GUI (entity manager) or extending a OroUser through code?

    The approach should be upgrade proof.

    Can you kindly help us with some inputs on this??

    Thanks!!!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #37645
    Andrey Yatsenko
    Andrey Yatsenko
    Moderator

    There is no way to combine User and Contact. I see several options to resolve your issue:
    1) the easiest one, add extra fields that you want to use from Contact to a User entity, and manage only Users. this could be done from UI or the code.
    2) create a relation from User to a Contact entity and create a User automatically, based on contact information, each time Contact is created. This can be done from code with the regular doctrine entity listener to prePersist event

    #37646
    Spurgeon
    Spurgeon
    Participant

    Dear Andrey,

    Thanks a ton for your kind inputs. They are surely encouraging!

    Can you please give more details for approach 2 please? May be some pointer to a sample code.

    Thanks once again!
    God bless you!

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No