本文整理汇总了PHP中Workflow::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::getId方法的具体用法?PHP Workflow::getId怎么用?PHP Workflow::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::getId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setCommonAttributes
/**
* @param WorkflowWizardForm $formModel
*/
protected function setCommonAttributes(WorkflowWizardForm $formModel)
{
$formModel->id = $this->workflow->getId();
$formModel->isActive = $this->workflow->getIsActive();
$formModel->description = $this->workflow->getDescription();
$formModel->moduleClassName = $this->workflow->getModuleClassName();
$formModel->name = $this->workflow->getName();
$formModel->triggerOn = $this->workflow->getTriggerOn();
$formModel->type = $this->workflow->getType();
$formModel->triggersStructure = $this->workflow->getTriggersStructure();
$formModel->timeTriggerAttribute = $this->workflow->getTimeTriggerAttribute();
if ($this->workflow->isNew()) {
$formModel->setIsNew();
}
$formModel->timeTrigger = $this->workflow->getTimeTrigger();
$formModel->triggers = $this->workflow->getTriggers();
$formModel->actions = $this->workflow->getActions();
$formModel->emailMessages = $this->workflow->getEmailMessages();
}
示例2: processEmailMessageAfterSave
/**
* @param Workflow $workflow
* @param EmailMessageForWorkflowForm $emailMessage
* @param RedBeanModel $model
* @param User $triggeredByUser
* @throws FailedToSaveModelException
*/
protected static function processEmailMessageAfterSave(Workflow $workflow, EmailMessageForWorkflowForm $emailMessage, RedBeanModel $model, User $triggeredByUser)
{
if ($emailMessage->sendAfterDurationInterval == 0) {
$helper = new WorkflowEmailMessageProcessingHelper($emailMessage, $model, $triggeredByUser);
$helper->process();
} else {
$emailMessageData = SavedWorkflowToWorkflowAdapter::makeArrayFromEmailMessageForWorkflowFormAttributesData(array($emailMessage));
$workflowMessageInQueue = new WorkflowMessageInQueue();
$workflowMessageInQueue->processDateTime = DateTimeUtil::convertTimestampToDbFormatDateTime($emailMessage->resolveNewTimeStampForDuration(time()));
$workflowMessageInQueue->savedWorkflow = SavedWorkflow::getById((int) $workflow->getId());
$workflowMessageInQueue->modelClassName = get_class($model);
$workflowMessageInQueue->modelItem = $model;
$workflowMessageInQueue->serializedData = serialize($emailMessageData);
$workflowMessageInQueue->triggeredByUser = $triggeredByUser;
$saved = $workflowMessageInQueue->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
}
}
示例3: testSetAndGetWorkflow
/**
* @depends testGetWorkflowSupportedModulesClassNamesCurrentUserHasAccessTo
*/
public function testSetAndGetWorkflow()
{
$timeTrigger = new TimeTriggerForWorkflowForm('WorkflowsTestModule', 'WorkflowModelTestItem', Workflow::TYPE_ON_SAVE);
$action = new ActionForWorkflowForm('WorkflowModelTestItem', Workflow::TYPE_ON_SAVE);
$emailMessage = new EmailMessageForWorkflowForm('WorkflowModelTestItem', Workflow::TYPE_ON_SAVE);
$trigger = new TriggerForWorkflowForm('WorkflowsTestModule', 'WorkflowModelTestItem', Workflow::TYPE_ON_SAVE);
$workflow = new Workflow();
$workflow->setModuleClassName('SomeModule');
$workflow->setDescription('a description');
$workflow->setTriggersStructure('1 AND 2');
$workflow->setTimeTriggerAttribute('something');
$workflow->setId(5);
$workflow->setIsActive(true);
$workflow->setOrder(6);
$workflow->setName('my workflow rule');
$workflow->setTriggerOn(Workflow::TRIGGER_ON_NEW);
$workflow->setType(Workflow::TYPE_ON_SAVE);
$workflow->setTimeTrigger($timeTrigger);
$workflow->addTrigger($trigger);
$workflow->addAction($action);
$workflow->addEmailMessage($emailMessage);
$this->assertEquals('SomeModule', $workflow->getModuleClassName());
$this->assertEquals('a description', $workflow->getDescription());
$this->assertEquals('1 AND 2', $workflow->getTriggersStructure());
$this->assertEquals('something', $workflow->getTimeTriggerAttribute());
$this->assertEquals(5, $workflow->getId());
$this->assertTrue($workflow->getIsActive());
$this->assertEquals(6, $workflow->getOrder());
$this->assertEquals('my workflow rule', $workflow->getName());
$this->assertEquals(Workflow::TRIGGER_ON_NEW, $workflow->getTriggerOn());
$this->assertEquals(Workflow::TYPE_ON_SAVE, $workflow->getType());
$this->assertEquals($timeTrigger, $workflow->getTimeTrigger());
$actions = $workflow->getActions();
$this->assertEquals($action, $actions[0]);
$this->assertCount(1, $actions);
$emailMessages = $workflow->getEmailMessages();
$this->assertEquals($emailMessage, $emailMessages[0]);
$this->assertCount(1, $emailMessages);
$triggers = $workflow->getTriggers();
$this->assertEquals($trigger, $triggers[0]);
$this->assertCount(1, $triggers);
$workflow->removeAllActions();
$actions = $workflow->getActions();
$this->assertCount(0, $actions);
$workflow->removeAllEmailMessages();
$emailMessages = $workflow->getEmailMessages();
$this->assertCount(0, $emailMessages);
$workflow->removeAllTriggers();
$triggers = $workflow->getTriggers();
$this->assertCount(0, $triggers);
$workflow->removeTimeTrigger();
$this->assertNull($workflow->getTimeTrigger());
}
示例4: getTransitions
/**
* Get the transitions of the workflow
*
* @param Workflow $workflow The workflow
*
* @return Array of Transition
*/
public function getTransitions(Workflow $workflow)
{
$transitions = array();
foreach ($this->getDao()->searchByWorkflow($workflow->getId()) as $row) {
$transitions[] = $this->getInstanceFromRow($row, $workflow);
}
return $transitions;
}
示例5: processToByTimeWorkflowInQueue
/**
* @param Workflow $workflow
* @param RedBeanModel $model
* @throws FailedToSaveModelException
*/
protected static function processToByTimeWorkflowInQueue(Workflow $workflow, RedBeanModel $model)
{
assert('$workflow->getId() > 0');
try {
$byTimeWorkflowInQueue = ByTimeWorkflowInQueue::resolveByWorkflowIdAndModel(SavedWorkflow::getById((int) $workflow->getId()), $model);
$byTimeWorkflowInQueue->processDateTime = static::resolveProcessDateTimeByWorkflowAndModel($workflow, $model);
$saved = $byTimeWorkflowInQueue->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
} catch (ValueForProcessDateTimeIsNullException $e) {
//For now just log this exception. If this exception is thrown it means a date or dateTime
//somehow was set to empty, so we can't properly process this.
WorkflowUtil::handleProcessingException($e, 'application.modules.workflows.utils.SavedWorkflowsUtil.processToByTimeWorkflowInQueue');
}
}
示例6: setWorkflow
/**
* Declares an association between this object and a Workflow object.
*
* @param Workflow $v
* @return WorkflowRole The current object (for fluent API support)
* @throws PropelException
*/
public function setWorkflow(Workflow $v = null)
{
if ($v === null) {
$this->setWorkFlowId(NULL);
} else {
$this->setWorkFlowId($v->getId());
}
$this->aWorkflow = $v;
// Add binding for other direction of this n:n relationship.
// If this object has already been added to the Workflow object, it will not be re-added.
if ($v !== null) {
$v->addWorkflowRole($this);
}
return $this;
}
示例7: processOnByTimeWorkflowInQueueJob
/**
* Process any workflow actions that are updates to the passed in model during the processing of any
* ByTimeWorkflowQueue models. @see ByTimeWorkflowInQueueJob.
* @param Workflow $workflow
* @param RedBeanModel $model
* @param User $triggeredByUser
* @throws FailedToSaveModelException
*/
public static function processOnByTimeWorkflowInQueueJob(Workflow $workflow, RedBeanModel $model, User $triggeredByUser)
{
foreach ($workflow->getActions() as $action) {
try {
$helper = new WorkflowActionProcessingHelper((int) $workflow->getId(), $workflow->getName(), $action, $model, $triggeredByUser, false);
$helper->processUpdateSelfAction();
$helper->processNonUpdateSelfAction();
} catch (Exception $e) {
WorkflowUtil::handleProcessingException($e, 'application.modules.workflows.utils.WorkflowActionsUtil.processOnByTimeWorkflowInQueueJob');
}
}
}
示例8: addInstanceToPool
/**
* Adds an object to the instance pool.
*
* Propel keeps cached copies of objects in an instance pool when they are retrieved
* from the database. In some cases -- especially when you override doSelect*()
* methods in your stub classes -- you may need to explicitly add objects
* to the cache in order to ensure that the same objects are always returned by doSelect*()
* and retrieveByPK*() calls.
*
* @param Workflow $value A Workflow object.
* @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
*/
public static function addInstanceToPool(Workflow $obj, $key = null)
{
if (Propel::isInstancePoolingEnabled()) {
if ($key === null) {
$key = (string) $obj->getId();
}
// if key === null
self::$instances[$key] = $obj;
}
}