Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / lib / Doctrine / DBAL / Event / SchemaAlterTableEventArgs.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\Column,
24     Doctrine\DBAL\Schema\TableDiff;
25
26 /**
27  * Event Arguments used when SQL queries for creating tables are generated inside Doctrine\DBAL\Platform\*Platform.
28  *
29  * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
30  * @link        www.doctrine-project.com
31  * @since       2.2
32  * @author      Jan Sorgalla <jsorgalla@googlemail.com>
33  */
34 class SchemaAlterTableEventArgs extends SchemaEventArgs
35 {
36     /**
37      * @var \Doctrine\DBAL\Schema\TableDiff
38      */
39     private $_tableDiff = null;
40
41     /**
42      * @var \Doctrine\DBAL\Platforms\AbstractPlatform
43      */
44     private $_platform = null;
45
46     /**
47      * @var array
48      */
49     private $_sql = array();
50
51     /**
52      * @param \Doctrine\DBAL\Schema\TableDiff $tableDiff
53      * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
54      */
55     public function __construct(TableDiff $tableDiff, AbstractPlatform $platform)
56     {
57         $this->_tableDiff = $tableDiff;
58         $this->_platform  = $platform;
59     }
60
61     /**
62      * @return \Doctrine\DBAL\Schema\TableDiff
63      */
64     public function getTableDiff()
65     {
66         return $this->_tableDiff;
67     }
68
69     /**
70      * @return \Doctrine\DBAL\Platforms\AbstractPlatform
71      */
72     public function getPlatform()
73     {
74         return $this->_platform;
75     }
76
77     /**
78      * @param string|array $sql
79      * @return \Doctrine\DBAL\Event\SchemaAlterTableEventArgs
80      */
81     public function addSql($sql)
82     {
83         if (is_array($sql)) {
84             $this->_sql = array_merge($this->_sql, $sql);
85         } else {
86             $this->_sql[] = $sql;
87         }
88
89         return $this;
90     }
91
92     /**
93      * @return array
94      */
95     public function getSql()
96     {
97         return $this->_sql;
98     }
99 }