Passed
Push — MODEL_LIB_240928 ( d6fbb6...55f3e4 )
by Rafael
49:14
created

ProductCombination   A

Complexity

Total Complexity 16

Size/Duplication

Total Lines 84
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 20
dl 0
loc 84
rs 10
c 1
b 0
f 0
wmc 16

16 Methods

Rating   Name   Duplication   Size   Complexity  
A createProductCombination() 0 3 1
A updateProperties() 0 3 1
A saveCombinationPriceLevels() 0 3 1
A copyAll() 0 3 1
A deleteByFkProductParent() 0 3 1
A fetchCombinationPriceLevels() 0 3 1
A fetchAllByFkProductParent() 0 5 1
A fetch() 0 3 1
A fetchByFkProductChild() 0 3 1
A delete2() 0 3 1
A update2() 0 3 1
A countNbOfCombinationForFkProductParent() 0 3 1
A getCombinationLabel() 0 3 1
A fetchByProductCombination2ValuePairs() 0 3 1
A getUniqueAttributesAndValuesByFkProductParent() 0 3 1
A create() 0 3 1
1
<?php
2
3
/* Copyright (C) 2024       Rafael San José         <[email protected]>
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
namespace Dolibarr\Code\Variants\Model;
20
21
class ProductCombination extends Model
22
{
23
    public $table = 'product_attribute_combination';
24
25
    public function fetch($rowid)
26
    {
27
        return DB::firstWhere('rowid', $rowid);
0 ignored issues
show
Bug introduced by
The type Dolibarr\Code\Variants\Model\DB was not found. Did you mean DB? If so, make sure to prefix the type with \.
Loading history...
28
    }
29
30
    public function fetchCombinationPriceLevels($fk_price_level = 0, $useCache = true)
31
    {
32
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
33
    }
34
35
    public function saveCombinationPriceLevels($clean = 1)
36
    {
37
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
38
    }
39
40
    public function fetchByFkProductChild($productid, $donotloadpricelevel = 0)
41
    {
42
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
43
    }
44
45
    public function fetchAllByFkProductParent($fk_product_parent, $sort_by_ref = false)
46
    {
47
        $result = ProductCombination::where('fk_product_parent', $fk_product_parent);
48
        dump($result);
49
        return $result;
50
    }
51
52
    public function countNbOfCombinationForFkProductParent($fk_product_parent)
53
    {
54
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
55
    }
56
57
    public function create($user)
58
    {
59
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
60
    }
61
62
    public function update2(User $user)
63
    {
64
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
65
    }
66
67
    public function delete2(User $user)
68
    {
69
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
70
    }
71
72
    public function deleteByFkProductParent($user, $fk_product_parent)
73
    {
74
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
75
    }
76
77
    public function updateProperties(Product $parent, User $user)
78
    {
79
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
80
    }
81
82
    public function fetchByProductCombination2ValuePairs($prodid, array $features)
83
    {
84
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
85
    }
86
87
    public function getUniqueAttributesAndValuesByFkProductParent($productid)
88
    {
89
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
90
    }
91
92
    public function createProductCombination(User $user, Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false, $forced_refvar = false, $ref_ext = '')
93
    {
94
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
95
    }
96
97
    public function copyAll(User $user, $origProductId, Product $destProduct)
98
    {
99
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
100
    }
101
102
    public function getCombinationLabel($prod_child)
103
    {
104
        die(__METHOD__ . ' of ' . __CLASS__);
0 ignored issues
show
Best Practice introduced by
Using exit here is not recommended.

In general, usage of exit should be done with care and only when running in a scripting context like a CLI script.

Loading history...
105
    }
106
}
107