OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – How do I? Questions Add Comment in Workflow

This topic contains 2 replies, has 2 voices, and was last updated by  Kadir Yücel 8 years, 4 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #36145

    Kadir Yücel
    Participant

    Hi,

    I try to add comment to a magento order. But it fails with that message:


    "Neither the property "order" nor one of the methods "addOrder()"/"removeOrder()", "setOrder()", "order()", "__set()" or "__call()" exist and have public access in class "Oro\Bundle\WorkflowBundle\Entity\WorkflowItem"."

    Commenting for entity “Magento Order” is activated. Schema update creates “order_142bf5fc_id” field in “oro_comment”

    my transition definition is:


    ...
    money_receipt_definition:
    post_actions:
    - @find_entity:
    class: OroCRM\Bundle\MagentoBundle\Entity\Order
    identifier: $order_id
    attribute: $.order
    - @create_entity: # create a comment
    class: Oro\Bundle\CommentBundle\Entity\Comment
    attribute: $.comment
    data:
    order: $.order
    message: $comment_message

    How can I associate order with comment in that case?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
    Replies
  • #36146

    Yevhen Shyshkin
    Participant

    Hello.

    1) You shouldn’t use property paths like $.order. Root entity of workflow is WorklfowItem, and $.order tries to access property “order” on a WorklfowItem (see error message). To do that you can either create new attribute in your flow and use it (e.g. attribute called “order” can be accessed via $order), or you can use “result” container as a temporary storage (i.e. use $.result.order instead of $.order). Same for $.comment.

    2) To associate comment with entity you should create Comment entity with action @create_entity (that you did), associate related entity via “target” property (you use “order” property instead) and fill relation fields, such as owner and organization (they can be copied from appropriate properties of order).

    If you still have issues related to your workflow – feel free to post them here.

    #36147

    Kadir Yücel
    Participant

    Thanx, this helped me!

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

The forum ‘OroPlatform – How do I? Questions’ is closed to new topics and replies.

Back to top