1<?php
2
3/*
4 * This file is part of the TYPO3 CMS project.
5 *
6 * It is free software; you can redistribute it and/or modify it under
7 * the terms of the GNU General Public License, either version 2
8 * of the License, or any later version.
9 *
10 * For the full copyright and license information, please read the
11 * LICENSE.txt file that was distributed with this source code.
12 *
13 * The TYPO3 project - inspiring people to share!
14 */
15
16namespace TYPO3\CMS\Extbase\Persistence\Generic\Qom;
17
18/**
19 * Tests whether the value of a property in a first selector is equal to the value of a
20 * property in a second selector.
21 * A node-tuple satisfies the constraint only if: the selector1Name node has a property named property1Name, and
22 * the selector2Name node has a property named property2Name, and
23 * the value of property property1Name is equal to the value of property property2Name.
24 * @internal only to be used within Extbase, not part of TYPO3 Core API.
25 */
26class EquiJoinCondition implements EquiJoinConditionInterface
27{
28    /**
29     * @var string
30     */
31    protected $selector1Name;
32
33    /**
34     * @var string
35     */
36    protected $property1Name;
37
38    /**
39     * @var string
40     */
41    protected $selector2Name;
42
43    /**
44     * @var string
45     */
46    protected $property2Name;
47
48    /**
49     * Constructs this EquiJoinCondition instance
50     *
51     * @param string $selector1Name the name of the first selector; non-null
52     * @param string $property1Name the property name in the first selector; non-null
53     * @param string $selector2Name the name of the second selector; non-null
54     * @param string $property2Name the property name in the second selector; non-null
55     */
56    public function __construct($selector1Name, $property1Name, $selector2Name, $property2Name)
57    {
58        // @todo Test for selector1Name = selector2Name -> exception
59        $this->selector1Name = $selector1Name;
60        $this->property1Name = $property1Name;
61        $this->selector2Name = $selector2Name;
62        $this->property2Name = $property2Name;
63    }
64
65    /**
66     * Gets the name of the first selector.
67     *
68     * @return string the selector name; non-null
69     */
70    public function getSelector1Name()
71    {
72        return $this->selector1Name;
73    }
74
75    /**
76     * Gets the name of the first property.
77     *
78     * @return string the property name; non-null
79     */
80    public function getProperty1Name()
81    {
82        return $this->property1Name;
83    }
84
85    /**
86     * Gets the name of the second selector.
87     *
88     * @return string the selector name; non-null
89     */
90    public function getSelector2Name()
91    {
92        return $this->selector2Name;
93    }
94
95    /**
96     * Gets the name of the second property.
97     *
98     * @return string the property name; non-null
99     */
100    public function getProperty2Name()
101    {
102        return $this->property2Name;
103    }
104
105    /**
106     * Gets the name of the child selector.
107     *
108     * @return string the selector name; non-null
109     */
110    public function getChildSelectorName()
111    {
112        return '';
113    }
114
115    /**
116     * Gets the name of the parent selector.
117     *
118     * @return string the selector name; non-null
119     */
120    public function getParentSelectorName()
121    {
122        return '';
123    }
124}
125