OroPlatform Forums

Covering OroPlatform topics, including community updates and company announcements.

Forums Forums OroPlatform OroPlatform – Programming Questions Accessing context programmatically

This topic contains 1 reply, has 1 voice, and was last updated by  andytnumiko 8 years, 2 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
  • #34042

    andytnumiko
    Participant

    Hi,

    I need to access context data to use it directly. It looks like one way of doing that is (example from ActivityContextController):


    $className = $this->get('oro_entity.routing_helper')->resolveEntityClass($activity);
    $result = $this->getManager()->getActivityContext($className, $id);

    2 questions:

    1. Is this the best way?
    2. If the activity is Task, what should $activity (the $entityName parameter of resolveEntityClass()) in the above example be? I’ve tried every variation I can think of but always get an EntityAliasNotFoundException.

    thanks

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #34043

    andytnumiko
    Participant

    The best way seems to be to use the methods of ExtendActivity.

    e.g.


    $contextEntities = $activity->getActivityTargets(Type::class);

    where Type is the classname of the related data you want to access.

    Or getActivityTargetEntities() gets all context for the entity.

Viewing 1 replies (of 1 total)

The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.

Back to top