ssossossosso

Forums

Covering OroCRM topics, including community updates and company announcements.  Subscribe

This topic contains 6 replies, has 3 voices, and was last updated by ant-workaholic ant-workaholic 1 year, 10 months ago.

  • Creator
    Topic
  • #14767
    ant-workaholic
    ant-workaholic
    Participant

    Hello, Oro guys. I need your advise, how I can implement this. Now I have custom entity called “Atwork” which contains some attachments (in my case some images and files). I have created workflow for this entity (where manager can upload this files) as a result of this workflow I create new object of another custom entity (which called “Proofing”). Inside Proofing I also have attachments and I should have attachments which were added to “Atwork” too. Please, give me advise how I can implements this by the good way. (Maybe it is possible to do this inside workflow through custom transition or by another way).. Thank you very much.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #14774
    Artem Liubeznyi
    Artem Liubeznyi
    Oro Core

    Hi Igor,

    Have you checked our implementation of re-attaching files from a record to the email sent as activity from this record, or vice versa? Your case looks very similar to it.

    #14781
    ant-workaholic
    ant-workaholic
    Participant

    I guess, no. Where I can find this? In which bundle? Thank you.

    #14783
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Hello.

    Probably, you should create custom workflow action for it using AttachmentManager::copyAttachmentFile method. For custom action manual see this topic.

    If you still have issues after all that – feel free to post them here.

    #14799
    ant-workaholic
    ant-workaholic
    Participant

    Thank you for advise.
    Now, I have created new action in which I get my “Atwork” entity and get all attachments by this way:

    $attachments = $this->_attachmentProvider->getEntityAttachments($mainEntity);

    The property $_attachmentProvider I have injected using constructor injection and this is Oro\Bundle\AttachmentBundle\Provider\AttachmentProvider.
    The variable $attacments now consist of array of Attachment objects. But for AttachmentManager::copyAttachmentFile as I see, I need provide File object, I can get this for each attachment separately, I guess. AttachmentManager::copyAttachmentFile will return copy of my attachment file. And now I just need to attach copy of this files to my “Proofing” entity. How I can do this by simple way? Is my thoughts correct? Thank you.

    #14802
    Yevhen Shyshkin
    Yevhen Shyshkin
    Oro Core

    Please, check this example – it makes copy of an entity, but basic idea just the same.

    #14803
    ant-workaholic
    ant-workaholic
    Participant

    Thank you, Yevhen!

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

You must be logged in to reply to this topic.