Completed
Push — master ( bcdba8...408d98 )
by Jan
03:54
created

PartLot   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 73
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 73
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A getIDString() 0 3 1
1
<?php
2
/**
3
 *
4
 * part-db version 0.1
5
 * Copyright (C) 2005 Christoph Lechner
6
 * http://www.cl-projects.de/
7
 *
8
 * part-db version 0.2+
9
 * Copyright (C) 2009 K. Jacobs and others (see authors.php)
10
 * http://code.google.com/p/part-db/
11
 *
12
 * Part-DB Version 0.4+
13
 * Copyright (C) 2016 - 2019 Jan Böhmer
14
 * https://github.com/jbtronics
15
 *
16
 * This program is free software; you can redistribute it and/or
17
 * modify it under the terms of the GNU General Public License
18
 * as published by the Free Software Foundation; either version 2
19
 * of the License, or (at your option) any later version.
20
 *
21
 * This program is distributed in the hope that it will be useful,
22
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24
 * GNU General Public License for more details.
25
 *
26
 * You should have received a copy of the GNU General Public License
27
 * along with this program; if not, write to the Free Software
28
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
29
 *
30
 */
31
32
namespace App\Entity\Parts;
33
34
35
use App\Entity\Base\DBElement;
36
use App\Entity\Base\NamedDBElement;
37
use App\Entity\Base\TimestampTrait;
38
use Doctrine\ORM\Mapping as ORM;
39
use Symfony\Component\Validator\Constraints as Assert;
40
41
/**
42
 * This entity describes a lot where parts can be stored.
43
 * It is the connection between a part and its store locations.
44
 * @package App\Entity\Parts
45
 * @ORM\Entity()
46
 * @ORM\Table(name="part_lots")
47
 * @ORM\HasLifecycleCallbacks()
48
 */
49
class PartLot extends DBElement
50
{
51
52
    use TimestampTrait;
53
54
    /**
55
     * @var string A short description about this lot, shown in table
56
     * @ORM\Column(type="text")
57
     */
58
    protected $description;
59
60
    /**
61
     * @var string A comment stored with this lot.
62
     * @ORM\Column(type="text")
63
     */
64
    protected $comment;
65
66
    /**
67
     * @var \DateTime Set a time until when the lot must be used.
68
     * Set to null, if the lot can be used indefinitley.
69
     * @ORM\Column(type="datetimetz", name="expiration_date", nullable=true)
70
     */
71
    protected $expiration_date;
72
73
    /**
74
     * @var Storelocation The storelocation of this lot
75
     * @ORM\ManyToOne(targetEntity="Storelocation")
76
     * @ORM\JoinColumn(name="id_store_location", referencedColumnName="id")
77
     */
78
    protected $storage_location;
79
80
    /**
81
     * @var Part The part that is stored in this lot
82
     * @ORM\ManyToOne(targetEntity="Part", inversedBy="partLots")
83
     * @ORM\JoinColumn(name="id_part", referencedColumnName="id")
84
     */
85
    protected $part;
86
87
    /**
88
     * @var bool If this is set to true, the instock amount is marked as not known
89
     * @ORM\Column(type="boolean")
90
     */
91
    protected $instock_unknown;
92
93
    /**
94
     * @var int For integer sizes the instock is saved here.
95
     * @ORM\Column(type="integer", nullable=true)
96
     * @Assert\Positive()
97
     */
98
    protected $instock;
99
100
    /**
101
     * @var float For continuos sizes (length, volume, etc.) the instock is saved here.
102
     * @ORM\Column(type="float", nullable=true)
103
     */
104
    protected $amount;
105
106
    /**
107
     * @var boolean Determines if this lot was manually marked for refilling.
108
     * @ORM\Column(type="boolean")
109
     */
110
    protected $needs_refill;
111
112
    /**
113
     * Returns the ID as an string, defined by the element class.
114
     * This should have a form like P000014, for a part with ID 14.
115
     *
116
     * @return string The ID as a string;
117
     *
118
     */
119
    public function getIDString(): string
120
    {
121
        return 'PL' . $this->getID();
122
    }
123
}