1
|
|
|
<?php |
2
|
|
|
namespace TildBJ\Seeder\Domain\Model\Column; |
3
|
|
|
|
4
|
|
|
/*************************************************************** |
5
|
|
|
* |
6
|
|
|
* Copyright notice |
7
|
|
|
* |
8
|
|
|
* (c) 2016 Dennis Römmich <[email protected]> |
9
|
|
|
* |
10
|
|
|
* All rights reserved |
11
|
|
|
* |
12
|
|
|
* This script is part of the TYPO3 project. The TYPO3 project is |
13
|
|
|
* free software; you can redistribute it and/or modify |
14
|
|
|
* it under the terms of the GNU General Public License as published by |
15
|
|
|
* the Free Software Foundation; either version 3 of the License, or |
16
|
|
|
* (at your option) any later version. |
17
|
|
|
* |
18
|
|
|
* The GNU General Public License can be found at |
19
|
|
|
* http://www.gnu.org/copyleft/gpl.html. |
20
|
|
|
* |
21
|
|
|
* This script 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
|
|
|
* This copyright notice MUST APPEAR in all copies of the script! |
27
|
|
|
***************************************************************/ |
28
|
|
|
use TildBJ\Seeder\Domain\Model\Column; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Class Inline |
32
|
|
|
* |
33
|
|
|
* @package TildBJ\Seeder\Domain\Model\Inline |
34
|
|
|
*/ |
35
|
|
|
class Inline extends Column implements InlineInterface |
36
|
|
|
{ |
37
|
|
|
/** |
38
|
|
|
* @return string |
39
|
|
|
*/ |
40
|
|
|
protected $foreignType; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* @return string |
44
|
|
|
*/ |
45
|
|
|
protected $foreignTable; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @return string |
49
|
|
|
*/ |
50
|
|
|
protected $foreignTableWhere; |
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* @var string |
54
|
|
|
*/ |
55
|
|
|
protected $foreignField; |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* @return array |
59
|
|
|
*/ |
60
|
|
|
protected $items; |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return int |
64
|
|
|
*/ |
65
|
|
|
protected $maxItems; |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* @return int |
69
|
|
|
*/ |
70
|
|
|
protected $minItems; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return int |
74
|
|
|
*/ |
75
|
|
|
protected $size; |
76
|
|
|
|
77
|
|
|
/** |
78
|
|
|
* Input constructor. |
79
|
|
|
* |
80
|
|
|
* @param string $columnName |
81
|
|
|
* @param $configuration |
82
|
|
|
*/ |
83
|
|
View Code Duplication |
public function __construct($columnName, $configuration) |
|
|
|
|
84
|
|
|
{ |
85
|
|
|
parent::__construct($columnName); |
86
|
|
|
$this->foreignType = $configuration['foreign_type']; |
87
|
|
|
$this->foreignTable = $configuration['foreign_table']; |
88
|
|
|
$this->foreignTableWhere = $configuration['foreign_table_where']; |
89
|
|
|
$this->foreignField = $configuration['foreign_field']; |
90
|
|
|
$this->items = $configuration['items']; |
91
|
|
|
$this->maxItems = $configuration['maxitems']; |
92
|
|
|
$this->minItems = $configuration['minitems']; |
93
|
|
|
$this->size = $configuration['size']; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @return string |
98
|
|
|
*/ |
99
|
|
|
public function getForeignType() |
100
|
|
|
{ |
101
|
|
|
return $this->foreignType; |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
/** |
105
|
|
|
* @return string |
106
|
|
|
*/ |
107
|
|
|
public function getForeignTable() |
108
|
|
|
{ |
109
|
|
|
return $this->foreignTable; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* getForeignField |
114
|
|
|
* |
115
|
|
|
* @return mixed |
|
|
|
|
116
|
|
|
*/ |
117
|
|
|
public function getForeignField() |
118
|
|
|
{ |
119
|
|
|
return $this->foreignField; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @return string |
124
|
|
|
*/ |
125
|
|
|
public function getForeignTableWhere() |
126
|
|
|
{ |
127
|
|
|
return $this->foreignTableWhere; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
/** |
131
|
|
|
* @return array |
132
|
|
|
*/ |
133
|
|
|
public function getItems() |
134
|
|
|
{ |
135
|
|
|
return $this->items; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
/** |
139
|
|
|
* @return int |
140
|
|
|
*/ |
141
|
|
|
public function getMaxItems() |
142
|
|
|
{ |
143
|
|
|
return $this->maxItems; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* @return int |
148
|
|
|
*/ |
149
|
|
|
public function getMinItems() |
150
|
|
|
{ |
151
|
|
|
return $this->minItems; |
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* @return int |
156
|
|
|
*/ |
157
|
|
|
public function getSize() |
158
|
|
|
{ |
159
|
|
|
return $this->size; |
160
|
|
|
} |
161
|
|
|
} |
162
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.