raoul2000 / yii2-workflow

A simple workflow engine for Yii2
BSD 3-Clause "New" or "Revised" License
171 stars 48 forks source link

workflow manager (for WorkflowDbSource) #32

Closed cornernote closed 8 years ago

cornernote commented 8 years ago

Thought you may want to have a play with this: https://github.com/cornernote/yii2-workflow-manager

It's based on your WorkflowDbSource gist: https://gist.github.com/raoul2000/c38165b7e6b5f12a6945#file-workflowdbsource-php

I turned it into a module. Would be great to see your feedback.

cornernote commented 8 years ago

Looks like this:

image

raoul2000 commented 8 years ago

:astonished: wow !! This seems very impressive work and be sure I will try it.

Having a quick look at the code, it brings me back to your performance question some days ago. Maybe one improvement would be to not use Yii2 ActiveRecord in the workflowDbSource component or at least return arrays instead AR instances. According to the definitive Guide to Yii2 this could be an interesting optimization when dealing with a large amount of records...

cornernote commented 8 years ago

I implemented cache (copied from WorkflowFileSource), so the number of ActiveRecord/DB hits should be minimal for loading workflow data. I am more concerned with instantiating all the workflow/status classes each time a model is loaded.

So far it's not been much overhead, however I need to try with larger jobs to get a better benchmark.

I submitted a PR to link to this from your readme, I hope that's ok.