Zeta Components - high quality PHP components

eZ Components - WorkflowEventLogTiein

Introduction

The WorkflowEventLogTiein component allows you to log workflow execution into files or other storage spaces in different formats using the EventLog component.

Class overview

ezcWorkflowEventLogListener
Wrapper for ezcLog that logs workflow events.

Usage

Log workflow execution to a file

This example shows how to log workflow execution into a file.

  1. <?php
  2. // Set up the logfile writer.
  3. $writer = new ezcLogUnixFileWriter'/tmp''workflow.log' );
  4. $log ezcLog::getInstance();
  5. $mapper $log->getMapper();
  6. $filter = new ezcLogFilter;
  7. $rule = new ezcLogFilterRule$filter$writertrue );
  8. $mapper->appendRule$rule );
  9. // Set up database connection.
  10. $db ezcDbFactory::create'mysql://test@localhost/test' );
  11. // Set up workflow definition storage (database).
  12. $definition = new ezcWorkflowDatabaseDefinitionStorage$db );
  13. // Load latest version of workflow named "Test".
  14. $workflow $definition->loadByName'Test' );
  15. // Set up database-based workflow executer.
  16. $execution = new ezcWorkflowDatabaseExecution$db );
  17. // Pass workflow object to workflow executer.
  18. $execution->workflow $workflow;
  19. // Attach logfile writer as a listener.
  20. $execution->addListener( new ezcWorkflowEventLogListener$log ) );
  21. // Start workflow execution.
  22. $id $execution->start();
  23. ?>

For more information on using the EventLog component please refer to its documentation.