Actions and Conditions in Operations 

ActionBundle provides several actions and conditions besides those in the Action Component.


Run Action Group @run_action_group.

Class: Oro\Bundle\ActionBundle\Action\RunActionGroup

Alias: run_action_group

Description: Runs named [action group](./ with passed parameters.


  • result - (optional) property path where the action group execution context value is allocated

  • results - (optional) property path where the results from action-group-context are mapped to current context keys

  • action_group - action group name

  • parameters_mapping - map of parameters passed to the action_group context from the current one

Configuration Example

- '@run_action_group':
    result: $.result
        result_entity_id: $.demo_new_attribute
    action_group: acme_demo_action_group
        entity_class: Acme\Bundle\DemoBundle\Entity\User
        entity_id: $

This configuration executes configured action group with the acme_demo_action_group name and parameters displayed under the parameters_mapping section. After the execution of action group, processed ActionData (e.g., context) is returned and assigned to the $.result attribute of the caller context. And $.result_entity_id acquires the value of $.demo_new_attribute from the Action Group’s context.

Please note that all parameters must pass validation and be accessible under the root node of ActionData in the action_group execution body. E.g., $.entity_class and $.entity_id respectively to their names. See the Action Groups documentation for more details.

Format Name 

Class: Oro\Bundle\ActionBundle\ActionFormatName

Alias: format_name

Description: Format entity name based on locale settings.


  • attribute - target path where the action results are saved;

  • object - entity;

Configuration Example

- '@format_name':
    attribute: $.result.formattedCustomerName
    object: $cart.customer

Create Date 

Class: Oro\Bundle\ActionBundle\Action\CreateDate

Alias: create_date

Description: Create DateTime object based on date string


  • date - (optional) date as a string. The current date by default;

  • attribute - target path where the action results are saved.

Configuration Example

- '@create_date':
    attribute: $action_start_date


- '@create_date':
            # optional condition configuration
        attribute: $action_start_date
        date: '2014-04-01' # must use quotes because the date parameter requires a string value

Copy Values 

Class: Oro\Component\Action\Action\CopyValues

Alias: copy_values

Description: Copies the values from a context or an object to the provided attribute and behaves like the array_merge PHP function.

- '@copy_values': [$.to, $.from1, $.from2, {key: 'value'}]

Resolve Destination Page 

Class: Oro\Bundle\ActionBundle\Action\ResolveDestinationPage

Alias: resolve_destination_page

Description: Resolves the URL redirection activity by a route name from the entity configuration using the routeName or routeView parameters.


  • destination / 0 - the route name specified in the #[Config] attribute of an entity

  • entity / 1 - (optional) property path of the original entity (by default, equals to entity)

  • attribute / 2 - (optional) target property path where the action results are saved (by default, equals to redirectUrl)

Configuration Example

 - '@resolve_destination_page': view


- '@resolve_destination_page': ['view', $.entity, $.attribute]


 - '@resolve_destination_page':
     name: index
     entity: $.data.entity


 - '@resolve_destination_page':
     name: index
     entity: $.entity
     attribute: $.attribute

Allowed values for the destination parameter:

  • for the index page (routeName) value can be name.

  • for the view page (routeView) value can be view.


Class: Oro\Bundle\ActionBundle\Action\DuplicateEntity

Alias: duplicate, duplicate_entity

Description: Duplicate entity object


  • entity - (optional) a property path of the original entity (by default, the getEntity() method is used from context)

  • target - (optional) a property path of the original entity, alias for entity

  • settings - (optional) a list of filters and matchers to be applied

  • attribute - a target property path where the action results are saved

Filters and Matchers:

Available filters: setNull, keep, collection, emptyCollection, replaceValue, and shallowCopy. Available matchers: property, propertyName, and propertyType.

For more information, please refer to the DeepCopy documentation.

Configuration Example

- '@duplicate':
    target: $.entity
    attribute: $.entityCopy
      - [[setNull], [propertyName, [id]]]
      - [[collection], [propertyName, [items]]]
      - [[replaceValue, $.currentUser], [propertyName, [user]]]
      - [[keep], [propertyName, [owner]]]
      - [[shallowCopy], [propertyType, ['\DateTime']]]
      - [[keep], [propertyType, ['%oro_user.entity.user%']]]


Add Custom Condition 

The conditions are based on the ConfigExpression component.

To add a custom condition, add a service to DIC with the “oro_action.condition” tag, for example:

            - { name: oro_action.condition, alias: blank|empty }

The “|” symbol in alias can be used to demonstrate several aliases. Note that service class must implement Oro\Component\ConfigExpression\ExpressionInterface.

Configurable Condition 

Alias: - the option is configurable.

Description: - uses Condition Assembler to assemble conditions from the passed configuration. This condition is NOT intended to be used in the configuration of Action. But it can be used to create a condition based on the configuration in runtime.

Options: - valid configuration of conditions.

Code Example

Code Example is a value of the “call_timeout” attribute. It is not blank, and it equals to 20.

$configuration = [
    '@and' => [
        '@not_blank' => ['$call_timeout'],
        '@equal' => ['$call_timeout', 20]
/** @var \Oro\Bundle\ActionBundle\Model\Condition\ConditionFactory $conditionFactory */
$condition = $conditionFactory->create(Configurable::ALIAS, $configuration);

/** @var object $data */
$data->call_timeout = 20;

var_dump($condition->evaluate($data)); // will output TRUE