ssossossossosso

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 2 years, 1 month ago.

  • Creator
    Topic
  • #30492

    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
  • #30493

    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.

    #30494

    Kadir Yücel
    Participant

    Thanx, this helped me!

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

You must be logged in to reply to this topic.