SchemaDropTableEventArgs.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 LGPL. For more information, see
  17. * <http://www.doctrine-project.org>.
  18. */
  19. namespace Doctrine\DBAL\Event;
  20. use Doctrine\DBAL\Platforms\AbstractPlatform,
  21. Doctrine\DBAL\Schema\Table;
  22. /**
  23. * Event Arguments used when the SQL query for dropping tables are generated inside Doctrine\DBAL\Platform\AbstractPlatform.
  24. *
  25. * @license http://www.opensource.org/licenses/lgpl-license.php LGPL
  26. * @link www.doctrine-project.com
  27. * @since 2.2
  28. * @author Jan Sorgalla <jsorgalla@googlemail.com>
  29. */
  30. class SchemaDropTableEventArgs extends SchemaEventArgs
  31. {
  32. /**
  33. * @var string|\Doctrine\DBAL\Schema\Table
  34. */
  35. private $_table = null;
  36. /**
  37. * @var \Doctrine\DBAL\Platforms\AbstractPlatform
  38. */
  39. private $_platform = null;
  40. /**
  41. * @var string
  42. */
  43. private $_sql = null;
  44. /**
  45. * @param string|\Doctrine\DBAL\Schema\Table $table
  46. * @param \Doctrine\DBAL\Platforms\AbstractPlatform $platform
  47. */
  48. public function __construct($table, AbstractPlatform $platform)
  49. {
  50. if (!$table instanceof Table && !is_string($table)) {
  51. throw new \InvalidArgumentException('SchemaCreateTableEventArgs expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
  52. }
  53. $this->_table = $table;
  54. $this->_platform = $platform;
  55. }
  56. /**
  57. * @return string|\Doctrine\DBAL\Schema\Table
  58. */
  59. public function getTable()
  60. {
  61. return $this->_table;
  62. }
  63. /**
  64. * @return \Doctrine\DBAL\Platforms\AbstractPlatform
  65. */
  66. public function getPlatform()
  67. {
  68. return $this->_platform;
  69. }
  70. /**
  71. * @param string $sql
  72. * @return \Doctrine\DBAL\Event\SchemaDropTableEventArgs
  73. */
  74. public function setSql($sql)
  75. {
  76. $this->_sql = $sql;
  77. return $this;
  78. }
  79. /**
  80. * @return string
  81. */
  82. public function getSql()
  83. {
  84. return $this->_sql;
  85. }
  86. }