1
|
|
|
<?php |
2
|
|
|
namespace TildBJ\Seeder\Domain\Model; |
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\Factory\TableFactory; |
29
|
|
|
use TildBJ\Seeder\Provider\TableConfiguration; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Class Table |
33
|
|
|
* |
34
|
|
|
* @package TildBJ\Seeder\Domain\Model\Table |
35
|
|
|
*/ |
36
|
|
|
class Table implements TableInterface |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* @var array |
40
|
|
|
*/ |
41
|
|
|
protected $columns; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
protected $name; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Table constructor. |
50
|
|
|
* |
51
|
|
|
* @param TableConfiguration $tableConfiguration |
52
|
|
|
*/ |
53
|
|
|
public function __construct(TableConfiguration $tableConfiguration) |
54
|
|
|
{ |
55
|
|
|
foreach ($tableConfiguration->getColumns() as $columnName) { |
56
|
|
|
$this->columns[] = TableFactory::createColumn( |
57
|
|
|
$tableConfiguration->getName(), |
58
|
|
|
$columnName |
59
|
|
|
); |
60
|
|
|
} |
61
|
|
|
$this->name = $tableConfiguration->getName(); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @return array |
66
|
|
|
*/ |
67
|
|
|
public function getColumns() |
68
|
|
|
{ |
69
|
|
|
return $this->columns; |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @return string |
74
|
|
|
*/ |
75
|
|
|
public function getName() |
76
|
|
|
{ |
77
|
|
|
return $this->name; |
78
|
|
|
} |
79
|
|
|
} |
80
|
|
|
|