AssociationValueEntry::getId()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 0
cts 2
cp 0
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
3
/*
4
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
5
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
6
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
7
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
8
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
9
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
10
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
11
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
12
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
13
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
14
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
15
 *
16
 * The software is based on the Axon Framework project which is
17
 * licensed under the Apache 2.0 license. For more information on the Axon Framework
18
 * see <http://www.axonframework.org/>.
19
 * 
20
 * This software consists of voluntary contributions made by many individuals
21
 * and is licensed under the MIT license. For more information, see
22
 * <http://www.governor-framework.org/>.
23
 */
24
25
namespace Governor\Framework\Saga\Repository\Orm;
26
27
use Doctrine\ORM\Mapping as ORM;
28
use Governor\Framework\Saga\AssociationValue;
29
30
/**
31
 * Description of AssociationValueEntry
32
 *
33
 * @author    "David Kalosi" <[email protected]>  
34
 * @license   <a href="http://www.opensource.org/licenses/mit-license.php">MIT License</a> 
35
 * @ORM\Entity
36
 * @ORM\Table(name="governor_association_values")
37
 */
38
class AssociationValueEntry
39
{
40
41
    /**
42
     * @ORM\Id
43
     * @ORM\Column(type="integer", name="id")
44
     * @ORM\GeneratedValue(strategy="AUTO")
45
     * @var integer
46
     */
47
    private $id;
48
49
    /**
50
     * @ORM\Column(type="string", name="saga_id")
51
     * @var string 
52
     */
53
    private $sagaId;
54
55
    /**
56
     * @ORM\Column(type="string", name="association_key")
57
     * @var string 
58
     */
59
    private $associationKey;
60
61
    /**
62
     * @ORM\Column(type="string", name="association_value")
63
     * @var string 
64
     */
65
    private $associationValue;
66
67
    /**
68
     * @ORM\Column(type="string", name="saga_type")
69
     * @var string 
70
     */
71
    private $sagaType;
72
73
    /**
74
     * Initialize a new AssociationValueEntry for a saga with given <code>sagaIdentifier</code> and
75
     * <code>associationValue</code>.
76
     *
77
     * @param string $sagaType         The type of Saga this association value belongs to
78
     * @param string $sagaIdentifier   The identifier of the saga
79
     * @param AssociationValue $associationValue The association value for the saga
80
     */
81 8
    public function __construct($sagaType, $sagaIdentifier,
82
            AssociationValue $associationValue)
83
    {
84 8
        $this->sagaType = $sagaType;
85 8
        $this->sagaId = $sagaIdentifier;
86 8
        $this->associationKey = $associationValue->getPropertyKey();
87 8
        $this->associationValue = $associationValue->getPropertyValue();
88 8
    }
89
90
    /**
91
     * Returns the association value contained in this entry.
92
     *
93
     * @return AssociationValue the association value contained in this entry
94
     */
95
    public function getAssociationValue()
96
    {
97
        return new AssociationValue($this->associationKey,
98
                $this->associationValue);
99
    }
100
101
    /**
102
     * Returns the Saga Identifier contained in this entry.
103
     *
104
     * @return string the Saga Identifier contained in this entry
105
     */
106
    public function getSagaIdentifier()
107
    {
108
        return $this->sagaId;
109
    }
110
111
    /**
112
     * Returns the type (fully qualified class name) of the Saga this association value belongs to
113
     *
114
     * @return string the type (fully qualified class name) of the Saga
115
     */
116
    public function getSagaType()
117
    {
118
        return $this->sagaType;
119
    }
120
121
    /**
122
     * The unique identifier of this entry.
123
     *
124
     * @return integer the unique identifier of this entry
125
     */
126
    public function getId()
127
    {
128
        return $this->id;
129
    }
130
131
}
132