MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
CreateSchemaSqlCollector.php
Ir para a documentação deste ficheiro.
1<?php
2/*
3 * $Id$
4 *
5 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
6 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
7 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
8 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
9 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
10 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
11 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
12 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
13 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
14 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
15 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
16 *
17 * This software consists of voluntary contributions made by many individuals
18 * and is licensed under the LGPL. For more information, see
19 * <http://www.doctrine-project.org>.
20 */
21
23
32
34{
38 private $_createTableQueries = array();
39
43 private $_createSequenceQueries = array();
44
48 private $_createFkConstraintQueries = array();
49
54 private $_platform = null;
55
59 public function __construct(AbstractPlatform $platform)
60 {
61 $this->_platform = $platform;
62 }
63
67 public function acceptSchema(Schema $schema)
68 {
69
70 }
71
77 public function acceptTable(Table $table)
78 {
79 $this->_createTableQueries = array_merge($this->_createTableQueries,
80 $this->_platform->getCreateTableSQL($table)
81 );
82 }
83
84 public function acceptColumn(Table $table, Column $column)
85 {
86
87 }
88
93 public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
94 {
95 // Append the foreign key constraints SQL
96 if ($this->_platform->supportsForeignKeyConstraints()) {
97 $this->_createFkConstraintQueries = array_merge($this->_createFkConstraintQueries,
98 (array) $this->_platform->getCreateForeignKeySQL(
99 $fkConstraint, $localTable->getQuotedName($this->_platform)
100 )
101 );
102 }
103 }
104
109 public function acceptIndex(Table $table, Index $index)
110 {
111
112 }
113
117 public function acceptSequence(Sequence $sequence)
118 {
119 $this->_createSequenceQueries = array_merge(
120 $this->_createSequenceQueries, (array)$this->_platform->getCreateSequenceSQL($sequence)
121 );
122 }
123
127 public function resetQueries()
128 {
129 $this->_createTableQueries = array();
130 $this->_createSequenceQueries = array();
131 $this->_createFkConstraintQueries = array();
132 }
133
139 public function getQueries()
140 {
141 return array_merge(
142 $this->_createTableQueries,
143 $this->_createSequenceQueries,
144 $this->_createFkConstraintQueries
145 );
146 }
147}
getQuotedName(AbstractPlatform $platform)
acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)