Forums

Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

Forums OroCRM OroCRM – How do I? Questions Repository which loading all account activities

This topic contains 4 replies, has 2 voices, and was last updated by  dawid.zaroda 3 weeks, 5 days ago.

  • Creator
    Topic
  • #37520

    dawid.zaroda
    Participant

    I need to load all Activities of Account in SQL (especially date start of activity), how can I do it? I tried joins, but relations in database are in table with generated key, so it won’t work everywhere.
    Activities which I want to load: calls, emails, events

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #37521
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    Hello, Dawid.

    The easiest way to do that is to call ActivityList repository and request an appropriate query builder:

    As you can see you may pass multiple activity classes. In the end application will generate an SQL like that:

    There is created_at field at the selected data – I guess this is what you need.

    #37522

    dawid.zaroda
    Participant

    Hello Yevhen,

    thank you for your response, I will check that and maybe it will be enough :)

    Also I have another question: what if I want to load this date for all accounts in database and filter results by my conditions? Performance is not very important, because this code will run only at night, one time.

    #37523
    Yevhen Shyshkin
    Yevhen Shyshkin
    Participant

    There are two solutions.

    1) Pass all account IDs there – looks like method can work with array of IDs as well.

    2) Create your own Query Builder inspired by the code at ActivityListRepository, but replace condition ‘accountId = X’ with ‘accountId IS NOT NULL’ – I guess it should be enough to get all required activities.

    #37525

    dawid.zaroda
    Participant

    Thank you for your help – I will try this solution.

    Regards

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

You must be logged in to reply to this topic.

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

Yes No
sso for www.magecore.comsso for oroinc.comsso for oroinc.desso for oroinc.frsso for marketplace.orocommerce.comsso for marketplace.orocrm.com