Passed
Push — MODEL_LIB_240928 ( 9bf6d2...bd3167 )
by Rafael
49:03
created

AccountingAccount::accountingSystem()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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
 * 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\Compta\Model;
20
21
use Carbon\Carbon;
22
use Dolibarr\Core\Base\Model;
23
24
/**
25
 * Class AccountingAccount
26
 *
27
 * @property int $rowid
28
 * @property int $entity
29
 * @property Carbon|null $datec
30
 * @property Carbon|null $tms
31
 * @property string $fk_pcg_version
32
 * @property string $pcg_type
33
 * @property string $account_number
34
 * @property int|null $account_parent
35
 * @property string $label
36
 * @property string|null $labelshort
37
 * @property int|null $fk_accounting_category
38
 * @property int|null $fk_user_author
39
 * @property int|null $fk_user_modif
40
 * @property int $active
41
 * @property int $reconcilable
42
 * @property string|null $import_key
43
 * @property string|null $extraparams
44
 *
45
 * @property AccountingSystem $accounting_system
46
 *
47
 * @package Dolibarr\Code\Compta\Model
48
 */
49
class AccountingAccount extends Model
50
{
51
    public $timestamps = false;
52
53
    protected $table = 'accounting_account';
54
55
    protected $casts = [
56
        'entity' => 'int',
57
        'datec' => 'datetime',
58
        'tms' => 'datetime',
59
        'account_parent' => 'int',
60
        'fk_accounting_category' => 'int',
61
        'fk_user_author' => 'int',
62
        'fk_user_modif' => 'int',
63
        'active' => 'int',
64
        'reconcilable' => 'int'
65
    ];
66
67
    protected $fillable = [
68
        'entity',
69
        'datec',
70
        'tms',
71
        'fk_pcg_version',
72
        'pcg_type',
73
        'account_number',
74
        'account_parent',
75
        'label',
76
        'labelshort',
77
        'fk_accounting_category',
78
        'fk_user_author',
79
        'fk_user_modif',
80
        'active',
81
        'reconcilable',
82
        'import_key',
83
        'extraparams'
84
    ];
85
86
    public function accountingSystem()
87
    {
88
        return $this->belongsTo(AccountingSystem::class, 'fk_pcg_version', 'pcg_version');
89
    }
90
}
91