MIOLO20
Carregando...
Procurando...
Nenhuma entrada encontrada
ForeignKeyConstraint.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
22namespace Doctrine\DBAL\Schema;
23
25
27{
31 protected $_localTable;
32
37
42
47
51 protected $_cascade = '';
52
56 protected $_options;
57
66 public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name=null, array $options=array())
67 {
68 $this->_setName($name);
69 $this->_localColumnNames = $localColumnNames;
70 $this->_foreignTableName = $foreignTableName;
71 $this->_foreignColumnNames = $foreignColumnNames;
72 $this->_options = $options;
73 }
74
78 public function getLocalTableName()
79 {
80 return $this->_localTable->getName();
81 }
82
86 public function setLocalTable(Table $table)
87 {
88 $this->_localTable = $table;
89 }
90
94 public function getLocalColumns()
95 {
97 }
98
99 public function getColumns()
100 {
102 }
103
107 public function getForeignTableName()
108 {
110 }
111
115 public function getForeignColumns()
116 {
118 }
119
120 public function hasOption($name)
121 {
122 return isset($this->_options[$name]);
123 }
124
125 public function getOption($name)
126 {
127 return $this->_options[$name];
128 }
129
135 public function onUpdate()
136 {
137 return $this->_onEvent('onUpdate');
138 }
139
145 public function onDelete()
146 {
147 return $this->_onEvent('onDelete');
148 }
149
154 private function _onEvent($event)
155 {
156 if (isset($this->_options[$event])) {
157 $onEvent = strtoupper($this->_options[$event]);
158 if (!in_array($onEvent, array('NO ACTION', 'RESTRICT'))) {
159 return $onEvent;
160 }
161 }
162 return false;
163 }
164}
__construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name=null, array $options=array())