Back to WorkflowBehaviorTrait class

Method workflowCleanupBatchMove

public null
workflowCleanupBatchMove
(mixed $oldId, mixed $newId)
Batch change workflow stage or current.
Parameters
  • int $oldId The ID of the item copied from
  • int $newId The ID of the new item
Returns
  • null
Since
  • 4.0.0

Method workflowCleanupBatchMove - Source code

/**
 * Batch change workflow stage or current.
 *
 * @param   integer  $oldId     The ID of the item copied from
 * @param   integer  $newId     The ID of the new item
 *
 * @return  null
 *
 * @since   4.0.0
 */
public function workflowCleanupBatchMove($oldId, $newId)
{
    // Trigger workflow plugins only if enable (will be triggered from parent class)
    if ($this->workflowEnabled) {
        $this->importWorkflowPlugins();
    }
    // We always need an association, so create one
    $table = $this->getTable();
    $table->load($newId);
    $catKey = $table->getColumnAlias('catid');
    $stage_id = $this->workflow->getDefaultStageByCategory($table->{$catKey});
    if (empty($stage_id)) {
        return;
    }
    $this->workflow->createAssociation((int) $newId, (int) $stage_id);
}