@@ 5-25 (lines=21) @@ | ||
2 | ||
3 | namespace Taisiya\PropelBundle\Database; |
|
4 | ||
5 | abstract class Index implements IndexInterface |
|
6 | { |
|
7 | use IndexTrait; |
|
8 | ||
9 | /** |
|
10 | * @param \DOMDocument $dom |
|
11 | * @param \DOMElement $table |
|
12 | */ |
|
13 | public function appendToXmlDocument(\DOMDocument $dom, \DOMElement $table): void |
|
14 | { |
|
15 | $index = $dom->createElement('index'); |
|
16 | $index->setAttribute('name', $this::getName()); |
|
17 | ||
18 | /** @var IndexColumn $indexColumn */ |
|
19 | foreach ($this->getColumns() as $indexColumn) { |
|
20 | $indexColumn->appendToXmlDocument($dom, $index); |
|
21 | } |
|
22 | ||
23 | $table->appendChild($index); |
|
24 | } |
|
25 | } |
|
26 |
@@ 5-23 (lines=19) @@ | ||
2 | ||
3 | namespace Taisiya\PropelBundle\Database; |
|
4 | ||
5 | abstract class Unique extends Index |
|
6 | { |
|
7 | /** |
|
8 | * @param \DOMDocument $dom |
|
9 | * @param \DOMElement $table |
|
10 | */ |
|
11 | public function appendToXmlDocument(\DOMDocument $dom, \DOMElement $table): void |
|
12 | { |
|
13 | $uniqueIndex = $dom->createElement('unique'); |
|
14 | $uniqueIndex->setAttribute('name', $this::getName()); |
|
15 | ||
16 | /** @var IndexColumn $indexColumn */ |
|
17 | foreach ($this->getColumns() as $indexColumn) { |
|
18 | $indexColumn->appendToXmlDocument($dom, $uniqueIndex); |
|
19 | } |
|
20 | ||
21 | $table->appendChild($uniqueIndex); |
|
22 | } |
|
23 | } |
|
24 |