Row::__construct()   A
last analyzed

Complexity

Conditions 3
Paths 3

Size

Total Lines 13
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 13
rs 9.4285
c 0
b 0
f 0
cc 3
eloc 7
nc 3
nop 2
1
<?php
2
/**
3
 * Created by Vitaly Iegorov <[email protected]>.
4
 * on 10.02.16 at 21:20
5
 */
6
namespace samsoncms\api\field;
7
8
/**
9
 * Additional fields table row.
10
 * This class is needed for generation of specific table row classes
11
 * with defined fields.
12
 *
13
 * @package samsoncms\api\field
14
 * @deprecated Use generated \samsoncms\api\generated\*TableEntity
15
 */
16
class Row
17
{
18
    /** @var array Collection of additional fields identifiers */
19
    protected static $fieldIDs = array();
20
    /** @var int Material primary identifier */
21
    public $primary;
22
    /** @var array Field table row fields collection */
23
    protected $collection;
24
25
    /**
26
     * Row constructor.
27
     *
28
     * @param int   $primary Material entity identifier
29
     * @param array $collection Collection of row additional field values
30
     */
31
    public function __construct($primary, array $collection)
32
    {
33
        $this->primary = $primary;
34
        $this->collection = $collection;
35
36
        // Set row fields
37
        foreach ($collection as $key => $value) {
38
            if ($key === 'primary') {
39
                continue;
40
            }
41
            $this->$key = $value;
42
        }
43
    }
44
}
45