GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Test Setup Failed
Pull Request — filters (#278)
by
unknown
09:57
created

GeneratedProductsPropertyGroupsCheck::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 5
rs 9.4286
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
use app\models\Object;
4
use app\models\ObjectPropertyGroup;
5
use app\modules\shop\models\Product;
6
use yii\helpers\Json;
7
use yii\db\Migration;
8
9
class m151230_122625_GeneratedProductsPropertyGroupsCheck 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...
10
{
11
    public function up()
12
    {
13
        $products = Product::findAll(['parent_id' => 0]);
14
        foreach ($products as $product) {
15
            $object = Object::getForClass(Product::className());
16
            $gid = Json::decode($product->option_generate)['group'];
17
            $cid = Product::findAll(['parent_id' => $product->id]);
18
            foreach ($cid as $subProduct) {
19
                $q = ObjectPropertyGroup::findAll(
20
                    'object_model_id = :object_model_id and object_id = :object_id and property_group_id = :property_group_id',
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 127 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
21
                    [
22
                        'object_model_id' => $subProduct->id,
23
                        'object_id' => $object->id,
24
                        'property_group_id' => $gid
25
                    ]
26
                );
27
                if (count($q) === 0) {
28
                    $opg = new ObjectPropertyGroup();
29
                    $opg->object_id = $object->id;
30
                    $opg->object_model_id = $subProduct->id;
31
                    $opg->property_group_id = $gid;
32
                    if ($opg->save()) {
33
                        echo 'Insert: ' . $opg->object_model_id . ' with property_group_id = ' . $opg->property_group_id . "\n";
0 ignored issues
show
Coding Style introduced by
This line exceeds maximum limit of 120 characters; contains 128 characters

Overly long lines are hard to read on any screen. Most code styles therefor impose a maximum limit on the number of characters in a line.

Loading history...
34
                    } else {
35
                        echo 'Insert error' . "\n";
36
                        print_r($opg->getErrors());
37
                    }
38
                }
39
            }
40
        }
41
    }
42
43
    public function down()
44
    {
45
        echo "m151230_122625_GeneratedProductsPropertyGroupsCheck down()\n";
46
        return true;
47
    }
48
}
49