Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / lib / Doctrine / DBAL / Event / SchemaIndexDefinitionEventArgs.php
1 <?php
2 /*
3  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  *
15  * This software consists of voluntary contributions made by many individuals
16  * and is licensed under the MIT license. For more information, see
17  * <http://www.doctrine-project.org>.
18 */
19
20 namespace Doctrine\DBAL\Event;
21
22 use Doctrine\DBAL\Connection,
23     Doctrine\DBAL\Schema\Index;
24
25 /**
26  * Event Arguments used when the portable index definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
27  *
28  * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
29  * @link        www.doctrine-project.com
30  * @since       2.2
31  * @author      Jan Sorgalla <jsorgalla@googlemail.com>
32  */
33 class SchemaIndexDefinitionEventArgs extends SchemaEventArgs
34 {
35     /**
36      * @var \Doctrine\DBAL\Schema\Index
37      */
38     private $_index = null;
39
40     /**
41      * Raw index data as fetched from the database
42      *
43      * @var array
44      */
45     private $_tableIndex = null;
46
47     /**
48      * @var string
49      */
50     private $_table = null;
51
52     /**
53      * @var \Doctrine\DBAL\Connection
54      */
55     private $_connection = null;
56
57     /**
58      * @param array  $tableIndex
59      * @param string $table
60      * @param \Doctrine\DBAL\Connection $conn
61      */
62     public function __construct(array $tableIndex, $table, Connection $connection)
63     {
64         $this->_tableIndex = $tableIndex;
65         $this->_table      = $table;
66         $this->_connection = $connection;
67     }
68
69     /**
70      * Allows to clear the index which means the index will be excluded from
71      * tables index list.
72      *
73      * @param null|\Doctrine\DBAL\Schema\Index $index
74      * @return SchemaIndexDefinitionEventArgs
75      */
76     public function setIndex(Index $index = null)
77     {
78         $this->_index = $index;
79
80         return $this;
81     }
82
83     /**
84      * @return \Doctrine\DBAL\Schema\Index
85      */
86     public function getIndex()
87     {
88         return $this->_index;
89     }
90
91     /**
92      * @return array
93      */
94     public function getTableIndex()
95     {
96         return $this->_tableIndex;
97     }
98
99     /**
100      * @return string
101      */
102     public function getTable()
103     {
104         return $this->_table;
105     }
106
107     /**
108      * @return \Doctrine\DBAL\Connection
109      */
110     public function getConnection()
111     {
112         return $this->_connection;
113     }
114
115     /**
116      * @return \Doctrine\DBAL\Platforms\AbstractPlatform
117      */
118     public function getDatabasePlatform()
119     {
120         return $this->_connection->getDatabasePlatform();
121     }
122 }