|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace OroCRM\Bundle\TaskBundle\Migrations\Schema\v1_10; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Schema\Schema; |
|
6
|
|
|
|
|
7
|
|
|
use Oro\Bundle\MigrationBundle\Migration\QueryBag; |
|
8
|
|
|
use Oro\Bundle\MigrationBundle\Migration\Migration; |
|
9
|
|
|
use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension; |
|
10
|
|
|
use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtensionAwareInterface; |
|
11
|
|
|
use Oro\Bundle\EntityExtendBundle\Migration\OroOptions; |
|
12
|
|
|
use Oro\Bundle\EntityConfigBundle\Migration\UpdateEntityConfigEntityValueQuery; |
|
13
|
|
|
|
|
14
|
|
|
class AddTaskStatusField implements Migration, ExtendExtensionAwareInterface |
|
15
|
|
|
{ |
|
16
|
|
|
/** @var ExtendExtension $extendExtension */ |
|
17
|
|
|
protected $extendExtension; |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* {@inheritdoc} |
|
21
|
|
|
*/ |
|
22
|
|
|
public function setExtendExtension(ExtendExtension $extendExtension) |
|
23
|
|
|
{ |
|
24
|
|
|
$this->extendExtension = $extendExtension; |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
/** |
|
28
|
|
|
* {@inheritdoc} |
|
29
|
|
|
*/ |
|
30
|
|
|
public function up(Schema $schema, QueryBag $queries) |
|
31
|
|
|
{ |
|
32
|
|
|
static::addTaskStatusField($schema, $this->extendExtension); |
|
33
|
|
|
static::addEnumValues($queries, $this->extendExtension); |
|
34
|
|
|
|
|
35
|
|
|
$queries->addPostQuery(new UpdateTaskStatusQuery($this->extendExtension)); |
|
36
|
|
|
|
|
37
|
|
|
$queries->addQuery( |
|
38
|
|
|
new UpdateEntityConfigEntityValueQuery( |
|
39
|
|
|
'OroCRM\Bundle\TaskBundle\Entity\Task', |
|
40
|
|
|
'workflow', |
|
41
|
|
|
'show_step_in_grid', |
|
42
|
|
|
false |
|
|
|
|
|
|
43
|
|
|
) |
|
44
|
|
|
); |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @param Schema $schema |
|
49
|
|
|
* @param ExtendExtension $extendExtension |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function addTaskStatusField(Schema $schema, ExtendExtension $extendExtension) |
|
52
|
|
|
{ |
|
53
|
|
|
$enumTable = $extendExtension->addEnumField( |
|
54
|
|
|
$schema, |
|
55
|
|
|
'orocrm_task', |
|
56
|
|
|
'status', |
|
57
|
|
|
'task_status' |
|
58
|
|
|
); |
|
59
|
|
|
|
|
60
|
|
|
$options = new OroOptions(); |
|
61
|
|
|
$options->set('enum', 'immutable_codes', ['open', 'in_progress', 'closed']); |
|
62
|
|
|
|
|
63
|
|
|
$enumTable->addOption(OroOptions::KEY, $options); |
|
|
|
|
|
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
/** |
|
67
|
|
|
* @param QueryBag $queries |
|
68
|
|
|
* @param ExtendExtension $extendExtension |
|
69
|
|
|
*/ |
|
70
|
|
|
public static function addEnumValues(QueryBag $queries, ExtendExtension $extendExtension) |
|
71
|
|
|
{ |
|
72
|
|
|
$queries->addPostQuery(new InsertTaskStatusesQuery($extendExtension)); |
|
73
|
|
|
} |
|
74
|
|
|
} |
|
75
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: