Yii Framework Forum: [EXTENSION] simpleWorkflow - Yii Framework Forum

Jump to content

  • (8 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[EXTENSION] simpleWorkflow a small workflow handler for models Rate Topic: ***** 3 Votes

#61 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 08 June 2011 - 01:29 PM

hey Ehsanjs !
if you're still thinking to use the workflow component provided by the EzComponents library, maybe this wiki article can be intresting for you ....
bye
8)
1

#62 User is offline   Ehsanjs 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 32
  • Joined: 12-April 11

Posted 09 June 2011 - 12:32 AM

Tanks Raoul
I am Ehsan and this article is written by myself
;)
0

#63 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 09 June 2011 - 10:43 AM

:lol::lol::lol:
2

#64 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 02 July 2011 - 10:23 AM

this is a reply to comment from philippfrenzel (read)

Hi philippfrenzel,
could you please provide more information on your problem ? The piece of code you posted in your comment doesn't contain any status change, so I'm not sure to understand what behavior you were expecting ? Is it a status change on the Customer or on the Event instance ?
ciao
Posted Image
0

#65 User is offline   PinkBrainPlan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 37
  • Joined: 06-February 11
  • Location:Austria

Posted 15 July 2011 - 08:59 AM

Hi Raoul,

I found out, that it was my own fault, as I send the status-field two times from two different Workflows...

What would be very helpful is if you can pls. post the code of your workflow samples too...? Is that possible, as I try to build an action on transition, where i change the status of a related workflow too...

Anyway your extension is so cool! As I rely on business processes, a workflow management is mandantory.. If I'm allowed, I will bring up some feature request within the next days?

Cheers Phil

View PostRaoul, on 02 July 2011 - 10:23 AM, said:

this is a reply to comment from philippfrenzel (read)

Hi philippfrenzel,
could you please provide more information on your problem ? The piece of code you posted in your comment doesn't contain any status change, so I'm not sure to understand what behavior you were expecting ? Is it a status change on the Customer or on the Event instance ?
ciao
Posted Image

0

#66 User is offline   windsor 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 04-October 11
  • Location:Tampa, FL

Posted 06 October 2011 - 10:46 AM

Hi Raoul,

Thank you for the simply AMAZING job you did with simpleWorkflow. I am very new at yii, so pardon me if this is a dumb question, but it seems like there can me many situations in a workflow when a node constraint is based on TIME. Say a rule like:

"step B can only occur after step A but must occur within 3 days of start of step A."

-or-

"if Step B does not occur within 3 days of Step A then transition to Step C"

How would you code these kinds of rules? Can it be done?

Thanks Again for your generosity and great documentation!
0

#67 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 06 October 2011 - 12:51 PM

Hi Windsor,
and thank for your comment about simpleWorkflow.... I apreciate.

Regarding your question, the cases you describe could be indeed very useful to handle with workflow... unfortunatly, the simpleWorkflow extension is currently not able to handle these scenario... it has no built-in feature to change the status of an object in an "automatic" way.
In its architecture, simpleWorkflow can't be viewed as a real workflow engine, it is only a behavior, added to Yii ActiveRecord. Moreover, the type of condition you describe on transition would require to implement different types of transitions : automatic transitions (triggered by time and.or logical conditions), manual transition (based from user action). Then, a real workflow engine should be implemented, independently for workflow items (ActiveRecord, Components), that would be called on each HTTP request in order to apply pending transitions.

This is an very intresting topic, but right now again, this is far from what simpleWorkflow is. I've been thinking about this kind of evolution (revolution) for the simpleWorkflow extension, and I wish I had enough time to implement my ideas ....

In the meantime, the only thing I can do for you is mention this wiki article, that describes (very briefly) how to use EzComponents with Yii. This open source library provides anintresting implementation of workflow classes that maybe can help you. You can also contact Ehsanjs (the author) who may have some experience on the subject.

Sorry I could not help you more ...
ciao
B)
0

#68 User is offline   windsor 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 63
  • Joined: 04-October 11
  • Location:Tampa, FL

Posted 07 October 2011 - 11:14 AM

Raoul,

Thanks for the quick reply and clear explanation. If you need some help putting your ideas into action, please reach out and email me, I have some time, but very little knowledge ;) This seems like a worthwhile and useful enhancement and I would be happy to help you in any way I can. For example, prototyping, testing, documentation, etc. Fair warning: I am by no means a "professional" developer anymore, but very willing to help and teachable. except if you ask my wife :D:) !
0

#69 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 07 October 2011 - 01:34 PM

Ok windosr, I take note of you offer and added you to my friend list ;)
ciao
8)
0

#70 User is offline   kjharni 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 02-November 11

Posted 09 December 2011 - 05:42 PM

Hi All,

First of all I would like to thank Raoul for this smart, great and amazing extension witch saves me a lot of work.

Yesterday, my web app went down displaying this phperror :

include(Canceled.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory
#0 /home/{...}/yii/framework/YiiBase.php(421): YiiBase::autoload()
#1 unknown(0): YiiBase::autoload("Canceled")
#2 unknown(0): spl_autoload_call("Canceled")
#3 /home/{...}/extensions/simpleWorkflow/SWNode.php(50): is_a("Canceled", "SWNode")
#4 /home/{...}/extensions/simpleWorkflow/SWNode.php(127): SWNode->__construct("Canceled", "swDemande")
#5 /home/{...}/extensions/simpleWorkflow/SWNode.php(78): SWNode->_loadTransition(array("Canceled" => "", "Submitted" => ""), "swDemande")

where "Canceled" is supposed to be a status.

This had no sense to me since the application was working fine.

I retrieved both the application and database on my computer and the application works perfectly.

I noticed that it was the is_a function witch tries le load the class file.

I figure out later that this function changed the its behaviors with the 5.3.7 release of PHP and that it was deprecated so I replaced it with the instanceof operator and the web app worked as a charm.

My provider upgrades php version from 5.2.17 to 5.3.8 and my wamp is on 5.3.0.

So may be a release is necessary to fix this issue.

Sorry for being long.

Thank you once again.
0

#71 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 09 December 2011 - 05:48 PM

View Postkjharni, on 09 December 2011 - 05:42 PM, said:

I figure out later that this function changed the its behaviors with the 5.3.7 release of PHP and that it was deprecated so I replaced it with the instanceof operator and the web app worked as a charm.

I did that too. And it works like a charm. :)
"Less noise - more signal"
0

#72 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 09 December 2011 - 06:39 PM

Hi to both of you,
.... and thanks for the feedback. I will release a new version as soon as possible and replace is_a by instanceof following your advice ;)
cheers
B)
0

#73 User is offline   Denis Roussel 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 28-October 11

Posted 12 January 2012 - 08:07 AM

Hi,


That looks like a great extension.

I'm quite a newbie in Yii, so I can't make it working.

I have an error :

include(correction.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory


If I declare a node without a transition, no error...

Here is the trace :

include(correction.php) [<a href='function.include'>function.include</a>]:
failed to open stream: No such file or directory
(E:\xampp\framework\YiiBase.php:421)
Stack trace:
#0 unknown(0): spl_autoload_call()
#1
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWNode.php(50):
is_a()
#2
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWNode.php(118):
SWNode->__construct()
#3
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWNode.php(77):
SWNode->_loadTransition()
#4
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWPhpWorkflowSource.php(87):
SWNode->__construct()
#5
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWPhpWorkflowSource.php(63):
SWPhpWorkflowSource->_createWorkflow()
#6
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWPhpWorkflowSource.php(202):
SWPhpWorkflowSource->_load()
#7
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWActiveRecordBehavior.php(311):
SWPhpWorkflowSource->getInitialNode()
#8
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWActiveRecordBehavior.php(232):
SWActiveRecordBehavior->swInsertToWorkflow()
#9
E:\xampp\htdocs\LPForms\protected\extensions\simpleWorkflow\SWActiveRecordBehavior.php(208):
SWActiveRecordBehavior->initialize()
#10 E:\xampp\framework\base\CComponent.php(336):
SWActiveRecordBehavior->attach()
#11 E:\xampp\framework\base\CComponent.php(303):
DemandeClient->attachBehavior()
#12 E:\xampp\framework\db\ar\CActiveRecord.php(373):
DemandeClient->attachBehaviors()
#13 E:\xampp\framework\db\ar\CActiveRecord.php(387): model()
#14 E:\xampp\framework\db\ar\CActiveRecord.php(62):
DemandeClient->getMetaData()
#15
E:\xampp\htdocs\LPForms\protected\controllers\DemandeClientController.php(48):
DemandeClient->__construct()
#16 E:\xampp\framework\web\actions\CInlineAction.php(50):
DemandeClientController->actionCreate()
#17 E:\xampp\framework\web\CController.php(300):
CInlineAction->runWithParams()
#18 E:\xampp\framework\web\filters\CFilterChain.php(134):
DemandeClientController->runAction()
#19 E:\xampp\framework\web\filters\CFilter.php(41): CFilterChain->run()
#20 E:\xampp\framework\web\CController.php(1144):
CAccessControlFilter->filter()
#21 E:\xampp\framework\web\filters\CInlineFilter.php(59):
DemandeClientController->filterAccessControl()
#22 E:\xampp\framework\web\filters\CFilterChain.php(131):
CInlineFilter->filter()
#23 E:\xampp\framework\web\CController.php(283): CFilterChain->run()
#24 E:\xampp\framework\web\CController.php(257):
DemandeClientController->runActionWithFilters()
#25 E:\xampp\framework\web\CWebApplication.php(277):
DemandeClientController->run()
#26 E:\xampp\framework\web\CWebApplication.php(136):
CWebApplication->runController()
#27 E:\xampp\framework\base\CApplication.php(158):
CWebApplication->processRequest()
#28 E:\xampp\htdocs\LPForms\index.php(13): CWebApplication->run()
REQUEST_URI=/lpforms/index.php?r=demandeclient/create


Could you give me a clue to solve this?


Many thanks


EDIT : No well slept this night... the answer was in front of me (in this case, the last post). Sorry guys!
0

#74 User is offline   robezy 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 03-April 12

Posted 03 April 2012 - 01:26 AM

Hi,

In my project, we are storing the status in a separate table, called statuses with a string column named status. What modification I need to do, to use this extension?


Thanks.
0

#75 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 10 April 2012 - 03:08 AM

Hi Robezy,
I must say that the modification you suggest is quite heavy work to do, as the simpleWorkflow extension is designed to use a specific attribute ('status') in the same table of the concerned active record.
I'll try to see if I can find an easy solution, but I don't garantee anything ...
ciao
B)
0

#76 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 09 May 2012 - 11:02 PM

Hi, Raoul.

What a great work have you done.

I'm testing it, and I configured my workflow as in the docs, but when i do a Save, I get "value is not a valid status"

My workflow config is:
return array(
    'initial' => 'new',
    'node' => array(
        array('id' => 'new', 'transition' => 'pending,rejected'),
        array('id' => 'pending', 'transition' => 'activated,rejected'),
        array('id' => 'rejected', 'transition' => 'pending'),
        array('id' => 'activated'),
    )
);


Any guidance you might give me?

Thank you in advance!
0

#77 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 10 May 2012 - 07:42 AM

View Postjmariani, on 09 May 2012 - 11:02 PM, said:

Hi, Raoul.

What a great work have you done.

I'm testing it, and I configured my workflow as in the docs, but when i do a Save, I get "value is not a valid status"

My workflow config is:
return array(
    'initial' => 'new',
    'node' => array(
        array('id' => 'new', 'transition' => 'pending,rejected'),
        array('id' => 'pending', 'transition' => 'activated,rejected'),
        array('id' => 'rejected', 'transition' => 'pending'),
        array('id' => 'activated'),
    )
);


Any guidance you might give me?

Thank you in advance!


Maybe there was some misunderstanding from myself.
I thought the behaviour will set the initial value for a status if the status is empty. Am I wrong?
If I set the status to a value before I save a new model, it works as expected, but if I leave the status empty, it throws a validation error.
0

#78 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 10 May 2012 - 09:01 AM

Hi!

Small question:

How to get the initial status from a model?
I want to set the status as initial in a beforeValidate event.

TIA!
0

#79 User is offline   Raoul 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 647
  • Joined: 29-November 08
  • Location:Paris, France

Posted 11 May 2012 - 02:50 AM

Hi jmariani,
(sorry I didn't see your messages before)

By default, the simpleWorkflow behavior is configured as autoInsert=true, which means that the newly created model instance is automatically inserted into its associated default workflow... so you understood well ;)

To find out why it doesn't occur in your case, my first suggestion would be to verify that a defautl workflow could be found.
First you could get the default Workflow Id associated with your model :

$workflowId = $model->swGetDefaultWorkflowId();


Then as you requested, get the intial status for this workflow :

Yii::app()->swSource->getInitialNode($workflowId);

// other option is to call swGetNextStatus() because if the model is not in a workflow, this method will return
// the initial node of the default workflow.

$next = $model->swGetNextStatus();
echo $next[0]->toString();



(I am currently away from my pc so unable to test the code above ....but it should work )

If this does not help, could you please provide a complete sample so I can try to reproduce the error this week-end ? ... or at least understan what's goign wrong.

ciao
B)
0

#80 User is offline   jmariani 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 53
  • Joined: 12-January 12

Posted 31 July 2012 - 09:07 PM

View PostRaoul, on 11 May 2012 - 02:50 AM, said:

Hi jmariani,
(sorry I didn't see your messages before)

By default, the simpleWorkflow behavior is configured as autoInsert=true, which means that the newly created model instance is automatically inserted into its associated default workflow... so you understood well ;)

To find out why it doesn't occur in your case, my first suggestion would be to verify that a defautl workflow could be found.
First you could get the default Workflow Id associated with your model :

$workflowId = $model->swGetDefaultWorkflowId();


Then as you requested, get the intial status for this workflow :

Yii::app()->swSource->getInitialNode($workflowId);

// other option is to call swGetNextStatus() because if the model is not in a workflow, this method will return
// the initial node of the default workflow.

$next = $model->swGetNextStatus();
echo $next[0]->toString();



(I am currently away from my pc so unable to test the code above ....but it should work )

If this does not help, could you please provide a complete sample so I can try to reproduce the error this week-end ? ... or at least understan what's goign wrong.

ciao
B)

Hi, Raoul.

Thank you for your support.
It looks like it never enters the "beforeSave" event and that's why it never gets the default initial status.
Any clue?
0

Share this topic:


  • (8 Pages)
  • +
  • « First
  • 2
  • 3
  • 4
  • 5
  • 6
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users