1 | <?php |
||
2 | |||
3 | namespace CWP\CWP\Extensions; |
||
4 | |||
5 | use SilverStripe\Core\Config\Config; |
||
6 | use SilverStripe\ORM\DataExtension; |
||
7 | use SilverStripe\ORM\DB; |
||
8 | use Symbiote\AdvancedWorkflow\DataObjects\WorkflowDefinition; |
||
0 ignored issues
–
show
|
|||
9 | |||
10 | /** |
||
11 | * Ensures that the default template is created |
||
12 | */ |
||
13 | class CwpWorkflowDefinitionExtension extends DataExtension |
||
14 | { |
||
15 | /** |
||
16 | * Create the default 'Two-step Workflow' when this extension is loaded |
||
17 | * |
||
18 | * @config |
||
19 | * @var boolean |
||
20 | */ |
||
21 | private static $create_default_workflow = true; |
||
0 ignored issues
–
show
|
|||
22 | |||
23 | public function requireDefaultRecords() |
||
24 | { |
||
25 | if (Config::inst()->get(CwpWorkflowDefinitionExtension::class, 'create_default_workflow')) { |
||
26 | // Only proceed if a definition using this template has not been created yet |
||
27 | $definition = WorkflowDefinition::get()->filter("Template", "Review and Approve")->First(); |
||
28 | if ($definition && $definition->exists()) { |
||
29 | return; |
||
30 | } |
||
31 | |||
32 | //generate from the template, which happens after we write the definition |
||
33 | $definition = WorkflowDefinition::create(); |
||
34 | $definition->Template = "Review and Approve"; |
||
35 | $definition->write(); |
||
36 | |||
37 | //change the title, description, and reminder days |
||
38 | $definition->update(array( |
||
39 | 'Title' => "Two-step Workflow", |
||
40 | 'Description' => "Content Authors can write content and Content Publishers can approve/reject.", |
||
41 | 'RemindDays' => 3, |
||
42 | )); |
||
43 | $definition->write(); |
||
44 | |||
45 | DB::alteration_message("Added default workflow definition to WorkflowDefinition table", "created"); |
||
46 | } |
||
47 | } |
||
48 | } |
||
49 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths