AnomalyModulePreferencesUpdateUserRelatedConfig   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 0
dl 0
loc 39
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 12 1
A down() 0 12 1
1
<?php
2
3
use Anomaly\Streams\Platform\Database\Migration\Migration;
4
5
/**
6
 * Class AnomalyModulePreferencesUpdateUserRelatedConfig
7
 *
8
 * @link   http://pyrocms.com/
9
 * @author PyroCMS, Inc. <[email protected]>
10
 * @author Ryan Thompson <[email protected]>
11
 */
12
class AnomalyModulePreferencesUpdateUserRelatedConfig extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
13
{
14
15
    /**
16
     * Run the migrations.
17
     *
18
     * @return void
19
     */
20
    public function up()
21
    {
22
        /* @var \Anomaly\Streams\Platform\Field\Contract\FieldInterface $field */
23
        $field = $this->fields()->findBySlugAndNamespace('user', 'preferences');
24
25
        $field->config = [
26
            'mode'    => 'lookup',
27
            'related' => 'Anomaly\UsersModule\User\UserModel',
28
        ];
29
30
        $field->save();
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        /* @var \Anomaly\Streams\Platform\Field\Contract\FieldInterface $field */
41
        $field = $this->fields()->findBySlugAndNamespace('user', 'preferences');
42
43
        $field->config = [
44
            'mode'    => 'lookup',
45
            'related' => 'Anomaly\UsersModule\User\UserModel',
46
        ];
47
48
        $field->save();
49
    }
50
}
51