mirror of
https://github.com/Karaka-Management/oms-Workflow.git
synced 2026-01-11 14:58:39 +00:00
phpstan and phpcs fixes
This commit is contained in:
parent
e4f9e7447a
commit
ee53a5172b
|
|
@ -10,7 +10,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 40,
|
"order": 40,
|
||||||
"from": "Wokflow",
|
"from": "Wokflow",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1003301001,
|
"parent": 1003301001,
|
||||||
"children": [
|
"children": [
|
||||||
{
|
{
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 1,
|
"order": 1,
|
||||||
"from": "Wokflow",
|
"from": "Wokflow",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005501001,
|
"parent": 1005501001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 5,
|
"order": 5,
|
||||||
"from": "Wokflow",
|
"from": "Wokflow",
|
||||||
"permission": { "permission": 2, "type": null, "element": null },
|
"permission": { "permission": 2, "category": null, "element": null },
|
||||||
"parent": 1005501001,
|
"parent": 1005501001,
|
||||||
"children": []
|
"children": []
|
||||||
},
|
},
|
||||||
|
|
@ -54,7 +54,7 @@
|
||||||
"icon": null,
|
"icon": null,
|
||||||
"order": 10,
|
"order": 10,
|
||||||
"from": "Wokflow",
|
"from": "Wokflow",
|
||||||
"permission": { "permission": 4, "type": null, "element": null },
|
"permission": { "permission": 4, "category": null, "element": null },
|
||||||
"parent": 1005501001,
|
"parent": 1005501001,
|
||||||
"children": []
|
"children": []
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,12 +74,12 @@ final class Installer extends InstallerAbstract
|
||||||
protected string $appName = 'Api';
|
protected string $appName = 'Api';
|
||||||
};
|
};
|
||||||
|
|
||||||
$apiApp->dbPool = $app->dbPool;
|
$apiApp->dbPool = $app->dbPool;
|
||||||
$apiApp->orgId = $app->orgId;
|
$apiApp->orgId = $app->orgId;
|
||||||
$apiApp->accountManager = $app->accountManager;
|
$apiApp->accountManager = $app->accountManager;
|
||||||
$apiApp->appSettings = $app->appSettings;
|
$apiApp->appSettings = $app->appSettings;
|
||||||
$apiApp->moduleManager = $app->moduleManager;
|
$apiApp->moduleManager = $app->moduleManager;
|
||||||
$apiApp->eventManager = $app->eventManager;
|
$apiApp->eventManager = $app->eventManager;
|
||||||
|
|
||||||
foreach ($workflowData as $workflow) {
|
foreach ($workflowData as $workflow) {
|
||||||
self::installWorkflow($apiApp, $workflow);
|
self::installWorkflow($apiApp, $workflow);
|
||||||
|
|
@ -112,6 +112,10 @@ final class Installer extends InstallerAbstract
|
||||||
$tempPath = __DIR__ . '/../../../temp/';
|
$tempPath = __DIR__ . '/../../../temp/';
|
||||||
|
|
||||||
$workflowFiles = \scandir(__DIR__ . '/../../..' . $data['path']);
|
$workflowFiles = \scandir(__DIR__ . '/../../..' . $data['path']);
|
||||||
|
if ($workflowFiles === false) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($workflowFiles as $filePath) {
|
foreach ($workflowFiles as $filePath) {
|
||||||
if (!\is_file(__DIR__ . '/../../..' . $data['path'] . '/' . $filePath) || $filePath === '..' || $filePath === '.') {
|
if (!\is_file(__DIR__ . '/../../..' . $data['path'] . '/' . $filePath) || $filePath === '..' || $filePath === '.') {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -131,6 +135,6 @@ final class Installer extends InstallerAbstract
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$module->apiTemplateCreate($request, $response);
|
$module->apiWorkflowTemplateCreate($request, $response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ use Modules\Workflow\Models\PermissionCategory;
|
||||||
use Modules\Workflow\Models\WorkflowInstance;
|
use Modules\Workflow\Models\WorkflowInstance;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceAbstract;
|
use Modules\Workflow\Models\WorkflowInstanceAbstract;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceMapper;
|
use Modules\Workflow\Models\WorkflowInstanceMapper;
|
||||||
|
use Modules\Workflow\Models\WorkflowStatus;
|
||||||
use Modules\Workflow\Models\WorkflowTemplate;
|
use Modules\Workflow\Models\WorkflowTemplate;
|
||||||
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
||||||
use phpOMS\Account\PermissionType;
|
use phpOMS\Account\PermissionType;
|
||||||
|
|
@ -50,6 +51,62 @@ use phpOMS\DataStorage\Database\Schema\Builder as SchemaBuilder;
|
||||||
*/
|
*/
|
||||||
final class ApiController extends Controller
|
final class ApiController extends Controller
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Api method to make a call to the cli app
|
||||||
|
*
|
||||||
|
* @param mixed ...$data Generic data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function runWorkflowFromHook(...$data) : void
|
||||||
|
{
|
||||||
|
$workflows = WorkflowTemplateMapper::getAll()->where('status', WorkflowStatus::ACTIVE)->execute();
|
||||||
|
foreach ($workflows as $workflow) {
|
||||||
|
$hooks = $workflow->getHooks();
|
||||||
|
|
||||||
|
foreach ($hooks as $hook) {
|
||||||
|
$triggerIsRegex = \stripos($data[':triggerGroup'], '/') === 0;
|
||||||
|
$matched = false;
|
||||||
|
|
||||||
|
if ($triggerIsRegex) {
|
||||||
|
$matched = \preg_match($data[':triggerGroup'], $hook) === 1;
|
||||||
|
} else {
|
||||||
|
$matched = $data[':triggerGroup'] === $hook;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$matched && \stripos($hook, '/') === 0) {
|
||||||
|
$matched = \preg_match($hook, $data[':triggerGroup']) === 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($matched) {
|
||||||
|
$this->runWorkflow($workflow, $hook, $data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Api method to make a call to the cli app
|
||||||
|
*
|
||||||
|
* @param WorkflowTemplate $workflow Workflow template
|
||||||
|
* @param string $hook Event hook
|
||||||
|
* @param array $data Event data
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
public function runWorkflow(WorkflowTemplate $workflow, string $hook, array $data) : void
|
||||||
|
{
|
||||||
|
include $workflow->source->getAbsolutePath();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routing end-point for application behaviour.
|
* Routing end-point for application behaviour.
|
||||||
*
|
*
|
||||||
|
|
@ -205,11 +262,11 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create view from template
|
* Create view from template/instance
|
||||||
*
|
*
|
||||||
* @param WorkflowInstanceAbstract $instance Instance to create view from
|
* @param WorkflowInstanceAbstract $instance Instance to create view from
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
* @param ResponseAbstract $response Response
|
* @param ResponseAbstract $response Response
|
||||||
*
|
*
|
||||||
* @return View
|
* @return View
|
||||||
*
|
*
|
||||||
|
|
@ -217,11 +274,13 @@ final class ApiController extends Controller
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
private function createView(WorkflowInstanceAbstract $instance, RequestAbstract $request, ResponseAbstract $response) : View
|
private function createView(
|
||||||
{
|
WorkflowInstanceAbstract $instance,
|
||||||
/** @var array<string, \Modules\Media\Models\Media|\Modules\Media\Models\Media[]> $tcoll */
|
RequestAbstract $request,
|
||||||
|
ResponseAbstract $response
|
||||||
|
) : View {
|
||||||
$tcoll = [];
|
$tcoll = [];
|
||||||
$files = $instance->source->getSources();
|
$files = $instance->template->source->getSources();
|
||||||
|
|
||||||
/** @var \Modules\Media\Models\Media $tMedia */
|
/** @var \Modules\Media\Models\Media $tMedia */
|
||||||
foreach ($files as $tMedia) {
|
foreach ($files as $tMedia) {
|
||||||
|
|
@ -345,7 +404,7 @@ final class ApiController extends Controller
|
||||||
$files[] = $upload;
|
$files[] = $upload;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Collection $collection */
|
/** @var \Modules\Media\Models\Collection $collection */
|
||||||
$collection = $this->app->moduleManager->get('Media')->createMediaCollectionFromMedia(
|
$collection = $this->app->moduleManager->get('Media')->createMediaCollectionFromMedia(
|
||||||
(string) ($request->getData('name') ?? ''),
|
(string) ($request->getData('name') ?? ''),
|
||||||
(string) ($request->getData('description') ?? ''),
|
(string) ($request->getData('description') ?? ''),
|
||||||
|
|
@ -376,8 +435,12 @@ final class ApiController extends Controller
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = $upload->getAbsolutePath();
|
$path = $upload->getAbsolutePath();
|
||||||
$content = \file_get_contents($path);
|
$content = \file_get_contents($path);
|
||||||
|
if ($content === false) {
|
||||||
|
$content = '';
|
||||||
|
}
|
||||||
|
|
||||||
$content = \str_replace('{workflow_id}', (string) $template->getId(), $content);
|
$content = \str_replace('{workflow_id}', (string) $template->getId(), $content);
|
||||||
\file_put_contents($path, $content);
|
\file_put_contents($path, $content);
|
||||||
}
|
}
|
||||||
|
|
@ -385,6 +448,15 @@ final class ApiController extends Controller
|
||||||
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Template', 'Template successfully created', $template);
|
$this->fillJsonResponse($request, $response, NotificationLevel::OK, 'Template', 'Template successfully created', $template);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create media directory path
|
||||||
|
*
|
||||||
|
* @param WorkflowTemplate $template Workflow template
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
private function createTemplateDir(WorkflowTemplate $template) : string
|
private function createTemplateDir(WorkflowTemplate $template) : string
|
||||||
{
|
{
|
||||||
return '/Modules/Workflow/'
|
return '/Modules/Workflow/'
|
||||||
|
|
@ -434,7 +506,6 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
$workflowTemplate->createdBy = new NullAccount($request->header->account);
|
$workflowTemplate->createdBy = new NullAccount($request->header->account);
|
||||||
$workflowTemplate->virtualPath = (string) ($request->getData('virtualpath') ?? '/');
|
|
||||||
|
|
||||||
return $workflowTemplate;
|
return $workflowTemplate;
|
||||||
}
|
}
|
||||||
|
|
@ -475,6 +546,8 @@ final class ApiController extends Controller
|
||||||
foreach ($definitions as $definition) {
|
foreach ($definitions as $definition) {
|
||||||
SchemaBuilder::createFromSchema($definition, $this->app->dbPool->get('schema'))->execute();
|
SchemaBuilder::createFromSchema($definition, $this->app->dbPool->get('schema'))->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -553,6 +626,7 @@ final class ApiController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \Modules\Workflow\Models\WorkflowControllerInterface $controller */
|
||||||
$instance = $controller->createInstanceFromRequest($request);
|
$instance = $controller->createInstanceFromRequest($request);
|
||||||
|
|
||||||
return $instance;
|
return $instance;
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,11 @@ namespace Modules\Workflow\Controller;
|
||||||
|
|
||||||
use Modules\Media\Models\CollectionMapper;
|
use Modules\Media\Models\CollectionMapper;
|
||||||
use Modules\Media\Models\NullMedia;
|
use Modules\Media\Models\NullMedia;
|
||||||
|
use Modules\Workflow\Models\WorkflowControllerInterface;
|
||||||
use Modules\Workflow\Models\WorkflowInstanceMapper;
|
use Modules\Workflow\Models\WorkflowInstanceMapper;
|
||||||
use Modules\Workflow\Models\WorkflowStatus;
|
use Modules\Workflow\Models\WorkflowStatus;
|
||||||
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
use Modules\Workflow\Models\WorkflowTemplateMapper;
|
||||||
|
use Modules\Workflow\Models\WorkflowTemplateStatus;
|
||||||
use phpOMS\Contract\RenderableInterface;
|
use phpOMS\Contract\RenderableInterface;
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
|
@ -34,60 +36,6 @@ use phpOMS\Views\View;
|
||||||
*/
|
*/
|
||||||
final class BackendController extends Controller
|
final class BackendController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Api method to make a call to the cli app
|
|
||||||
*
|
|
||||||
* @param mixed $data Generic data
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function runWorkflowFromHook(...$data) : void
|
|
||||||
{
|
|
||||||
$workflows = WorkflowTemplateMapper::getAll()->where('status', WorkflowStatus::ACTIVE)->execute();
|
|
||||||
foreach ($workflows as $workflow) {
|
|
||||||
$hooks = $workflow->getHooks();
|
|
||||||
|
|
||||||
foreach ($hooks as $hook) {
|
|
||||||
$triggerIsRegex = \stripos($data[':triggerGroup'], '/') === 0;
|
|
||||||
$matched = false;
|
|
||||||
|
|
||||||
if ($triggerIsRegex) {
|
|
||||||
$matched = \preg_match($data[':triggerGroup'], $hook) === 1;
|
|
||||||
} else {
|
|
||||||
$matched = $data[':triggerGroup'] === $hook;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$matched && \stripos($hook, '/') === 0) {
|
|
||||||
$matched = \preg_match($hook, $data[':triggerGroup']) === 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($matched) {
|
|
||||||
$this->runWorkflow($workflow, $hook, $data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Api method to make a call to the cli app
|
|
||||||
*
|
|
||||||
* @param mixed $data Generic data
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*
|
|
||||||
* @api
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function runWorkflow(WorkflowTemplate $workflow, string $hook, array $data) : void
|
|
||||||
{
|
|
||||||
include $workflow->media->getAbsolutePath();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Routing end-point for application behaviour.
|
* Routing end-point for application behaviour.
|
||||||
*
|
*
|
||||||
|
|
@ -270,7 +218,7 @@ final class BackendController extends Controller
|
||||||
/** @var WorkflowControllerInterface $controller */
|
/** @var WorkflowControllerInterface $controller */
|
||||||
$controller = new WorkflowController($this->app, $template);
|
$controller = new WorkflowController($this->app, $template);
|
||||||
|
|
||||||
$view->addData('instance', $controller->getInstanceFromRequest($request));
|
$view->addData('instance', $controller->createInstanceFromRequest($request));
|
||||||
|
|
||||||
if (!(($instance = $template->findFile('instance-profile.tpl.php')) instanceof NullMedia)) {
|
if (!(($instance = $template->findFile('instance-profile.tpl.php')) instanceof NullMedia)) {
|
||||||
$view->setTemplate('/' . \substr($instance->getPath(), 0, -8));
|
$view->setTemplate('/' . \substr($instance->getPath(), 0, -8));
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ final class CliController extends Controller
|
||||||
/**
|
/**
|
||||||
* Api method to make a call to the cli app
|
* Api method to make a call to the cli app
|
||||||
*
|
*
|
||||||
* @param mixed $data Generic data
|
* @param mixed ...$data Generic data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -55,7 +55,7 @@ final class CliController extends Controller
|
||||||
|
|
||||||
foreach ($hooks as $hook) {
|
foreach ($hooks as $hook) {
|
||||||
$triggerIsRegex = \stripos($data[':triggerGroup'], '/') === 0;
|
$triggerIsRegex = \stripos($data[':triggerGroup'], '/') === 0;
|
||||||
$matched = false;
|
$matched = false;
|
||||||
|
|
||||||
if ($triggerIsRegex) {
|
if ($triggerIsRegex) {
|
||||||
$matched = \preg_match($data[':triggerGroup'], $hook) === 1;
|
$matched = \preg_match($data[':triggerGroup'], $hook) === 1;
|
||||||
|
|
@ -77,7 +77,9 @@ final class CliController extends Controller
|
||||||
/**
|
/**
|
||||||
* Api method to make a call to the cli app
|
* Api method to make a call to the cli app
|
||||||
*
|
*
|
||||||
* @param mixed $data Generic data
|
* @param WorkflowTemplate $workflow Workflow template
|
||||||
|
* @param string $hook Event hook
|
||||||
|
* @param array $data Event data
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*
|
*
|
||||||
|
|
@ -87,7 +89,7 @@ final class CliController extends Controller
|
||||||
*/
|
*/
|
||||||
public function runWorkflow(WorkflowTemplate $workflow, string $hook, array $data) : void
|
public function runWorkflow(WorkflowTemplate $workflow, string $hook, array $data) : void
|
||||||
{
|
{
|
||||||
include $workflow->media->getAbsolutePath();
|
include $workflow->source->getAbsolutePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -153,7 +155,6 @@ final class CliController extends Controller
|
||||||
->execute();
|
->execute();
|
||||||
|
|
||||||
$controller = null;
|
$controller = null;
|
||||||
$mapper = null;
|
|
||||||
|
|
||||||
$files = $template->source->getSources();
|
$files = $template->source->getSources();
|
||||||
foreach ($files as $tMedia) {
|
foreach ($files as $tMedia) {
|
||||||
|
|
@ -168,6 +169,7 @@ final class CliController extends Controller
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var \Modules\Workflow\Models\WorkflowControllerInterface $controller */
|
||||||
$instance = $controller->createInstanceFromRequest($request);
|
$instance = $controller->createInstanceFromRequest($request);
|
||||||
$controller->createInstanceDbModel($instance);
|
$controller->createInstanceDbModel($instance);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,39 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Karaka
|
|
||||||
*
|
|
||||||
* PHP Version 8.0
|
|
||||||
*
|
|
||||||
* @package Modules\Workflow\Models
|
|
||||||
* @copyright Dennis Eichhorn
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @version 1.0.0
|
|
||||||
* @link https://karaka.app
|
|
||||||
*/
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace Modules\Workflow\Models;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Null model
|
|
||||||
*
|
|
||||||
* @package Modules\Workflow\Models
|
|
||||||
* @license OMS License 1.0
|
|
||||||
* @link https://karaka.app
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
final class NullWorkflowInstance extends WorkflowInstance
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param int $id Model id
|
|
||||||
*
|
|
||||||
* @since 1.0.0
|
|
||||||
*/
|
|
||||||
public function __construct(int $id = 0)
|
|
||||||
{
|
|
||||||
$this->id = $id;
|
|
||||||
parent::__construct();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -14,7 +14,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace Modules\Workflow\Models;
|
namespace Modules\Workflow\Models;
|
||||||
|
|
||||||
use phpOMS\Contract\RenderableInterface;
|
|
||||||
use phpOMS\Message\RequestAbstract;
|
use phpOMS\Message\RequestAbstract;
|
||||||
use phpOMS\Message\ResponseAbstract;
|
use phpOMS\Message\ResponseAbstract;
|
||||||
|
|
||||||
|
|
@ -53,9 +52,11 @@ interface WorkflowControllerInterface
|
||||||
/**
|
/**
|
||||||
* Change workflow instance state
|
* Change workflow instance state
|
||||||
*
|
*
|
||||||
* @param RequestAbstract $request Request
|
* @param RequestAbstract $request Request
|
||||||
|
* @param ResponseAbstract $response Response
|
||||||
|
* @param null|mixed $data Data
|
||||||
*
|
*
|
||||||
* @return WorkflowInstanceAbstract
|
* @return void
|
||||||
*
|
*
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ use Modules\Admin\Models\NullAccount;
|
||||||
* @link https://karaka.app
|
* @link https://karaka.app
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
class WorkflowInstanceAbstract
|
abstract class WorkflowInstanceAbstract
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* ID.
|
* ID.
|
||||||
|
|
@ -74,7 +74,7 @@ class WorkflowInstanceAbstract
|
||||||
*/
|
*/
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->template = new NullWorkflowTemplate();
|
$this->template = new NullWorkflowTemplate();
|
||||||
$this->createdBy = new NullAccount();
|
$this->createdBy = new NullAccount();
|
||||||
$this->createdAt = new \DateTimeImmutable('now');
|
$this->createdAt = new \DateTimeImmutable('now');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ class WorkflowTemplate
|
||||||
/**
|
/**
|
||||||
* Status.
|
* Status.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var int
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public int $status = WorkflowTemplateStatus::ACTIVE;
|
public int $status = WorkflowTemplateStatus::ACTIVE;
|
||||||
|
|
@ -120,6 +120,15 @@ class WorkflowTemplate
|
||||||
return $this->id;
|
return $this->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find file by file name
|
||||||
|
*
|
||||||
|
* @param string $name File name
|
||||||
|
*
|
||||||
|
* @return Media
|
||||||
|
*
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
public function findFile(string $name) : Media
|
public function findFile(string $name) : Media
|
||||||
{
|
{
|
||||||
$files = $this->source->getSources();
|
$files = $this->source->getSources();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user