Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / lib / Doctrine / DBAL / Event / SchemaCreateTableEventArgs.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\Platforms\AbstractPlatform,
23     Doctrine\DBAL\Schema\Table;
24
25 /**
26  * Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
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 SchemaCreateTableEventArgs extends SchemaEventArgs
34 {
35     /**
36      * @var \Doctrine\DBAL\Schema\Table
37      */
38     private $_table = null;
39
40     /**
41      * @var array
42      */
43     private $_columns = null;
44
45     /**
46      * @var array
47      */
48     private $_options = null;
49
50     /**
51      * @var \Doctrine\DBAL\Platforms\AbstractPlatform
52      */
53     private $_platform = null;
54
55     /**
56      * @var array
57      */
58     private $_sql = array();
59
60     /**
61      * @param \Doctrine\DBAL\Schema\Table $table
62      * @param array $columns
63      * @param array $options
64      * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
65      */
66     public function __construct(Table $table, array $columns, array $options, AbstractPlatform $platform)
67     {
68         $this->_table    = $table;
69         $this->_columns  = $columns;
70         $this->_options  = $options;
71         $this->_platform = $platform;
72     }
73
74     /**
75      * @return \Doctrine\DBAL\Schema\Table
76      */
77     public function getTable()
78     {
79         return $this->_table;
80     }
81
82     /**
83      * @return array
84      */
85     public function getColumns()
86     {
87         return $this->_columns;
88     }
89
90     /**
91      * @return array
92      */
93     public function getOptions()
94     {
95         return $this->_options;
96     }
97
98     /**
99      * @return \Doctrine\DBAL\Platforms\AbstractPlatform
100      */
101     public function getPlatform()
102     {
103         return $this->_platform;
104     }
105
106     /**
107      * @param string|array $sql
108      * @return \Doctrine\DBAL\Event\SchemaCreateTableEventArgs
109      */
110     public function addSql($sql)
111     {
112         if (is_array($sql)) {
113             $this->_sql = array_merge($this->_sql, $sql);
114         } else {
115             $this->_sql[] = $sql;
116         }
117
118         return $this;
119     }
120
121     /**
122      * @return array
123      */
124     public function getSql()
125     {
126         return $this->_sql;
127     }
128 }