1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace OroCRM\Bundle\SalesBundle\Migrations\Schema\v1_22; |
4
|
|
|
|
5
|
|
|
use Doctrine\DBAL\Schema\Schema; |
6
|
|
|
|
7
|
|
|
use Oro\Bundle\EntityConfigBundle\Entity\ConfigModel; |
8
|
|
|
use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtension; |
9
|
|
|
use Oro\Bundle\EntityExtendBundle\Migration\Extension\ExtendExtensionAwareInterface; |
10
|
|
|
use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope; |
11
|
|
|
use Oro\Bundle\MigrationBundle\Migration\Migration; |
12
|
|
|
use Oro\Bundle\MigrationBundle\Migration\QueryBag; |
13
|
|
|
use Oro\Bundle\EntityBundle\EntityConfig\DatagridScope; |
14
|
|
|
use Oro\Bundle\EntityExtendBundle\Migration\OroOptions; |
15
|
|
|
|
16
|
|
|
use OroCRM\Bundle\SalesBundle\Entity\Opportunity; |
17
|
|
|
|
18
|
|
|
class AddOpportunityState implements Migration, ExtendExtensionAwareInterface |
19
|
|
|
{ |
20
|
|
|
protected $extendExtension; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* @param ExtendExtension $extendExtension |
24
|
|
|
*/ |
25
|
|
|
public function setExtendExtension(ExtendExtension $extendExtension) |
26
|
|
|
{ |
27
|
|
|
$this->extendExtension = $extendExtension; |
28
|
|
|
} |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* {@inheritdoc} |
32
|
|
|
*/ |
33
|
|
|
public function up(Schema $schema, QueryBag $queries) |
34
|
|
|
{ |
35
|
|
|
self::addStateField($schema, $this->extendExtension); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @param Schema $schema |
40
|
|
|
* @param ExtendExtension $extendExtension |
41
|
|
|
*/ |
42
|
|
|
public static function addStateField(Schema $schema, ExtendExtension $extendExtension) |
43
|
|
|
{ |
44
|
|
|
$enumTable = $extendExtension->addEnumField( |
45
|
|
|
$schema, |
46
|
|
|
'orocrm_sales_opportunity', |
47
|
|
|
'state', |
48
|
|
|
Opportunity::INTERNAL_STATE_CODE, |
49
|
|
|
false, |
50
|
|
|
false, |
51
|
|
|
[ |
52
|
|
|
'extend' => ['owner' => ExtendScope::OWNER_SYSTEM], |
53
|
|
|
'datagrid' => ['is_visible' => DatagridScope::IS_VISIBLE_TRUE], |
54
|
|
|
'dataaudit' => ['auditable' => true], |
55
|
|
|
'importexport' => ["order" => 90, "short" => true] |
56
|
|
|
] |
57
|
|
|
); |
58
|
|
|
|
59
|
|
|
$options = new OroOptions(); |
60
|
|
|
$options->set( |
61
|
|
|
'enum', |
62
|
|
|
'immutable_codes', |
63
|
|
|
[ |
64
|
|
|
'identification_alignment', |
65
|
|
|
'needs_analysis', |
66
|
|
|
'solution_development', |
67
|
|
|
'negotiation', |
68
|
|
|
'won', |
69
|
|
|
'lost' |
70
|
|
|
] |
71
|
|
|
); |
72
|
|
|
|
73
|
|
|
$enumTable->addOption(OroOptions::KEY, $options); |
|
|
|
|
74
|
|
|
} |
75
|
|
|
} |
76
|
|
|
|
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: