SchemaIndexDefinitionEventArgs.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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\Connection,
  21. Doctrine\DBAL\Schema\Index;
  22. /**
  23. * Event Arguments used when the portable index definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
  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 SchemaIndexDefinitionEventArgs extends SchemaEventArgs
  31. {
  32. /**
  33. * @var \Doctrine\DBAL\Schema\Index
  34. */
  35. private $_index = null;
  36. /**
  37. * Raw index data as fetched from the database
  38. *
  39. * @var array
  40. */
  41. private $_tableIndex = null;
  42. /**
  43. * @var string
  44. */
  45. private $_table = null;
  46. /**
  47. * @var \Doctrine\DBAL\Connection
  48. */
  49. private $_connection = null;
  50. /**
  51. * @param array $tableIndex
  52. * @param string $table
  53. * @param \Doctrine\DBAL\Connection $conn
  54. */
  55. public function __construct(array $tableIndex, $table, Connection $connection)
  56. {
  57. $this->_tableIndex = $tableIndex;
  58. $this->_table = $table;
  59. $this->_connection = $connection;
  60. }
  61. /**
  62. * Allows to clear the index which means the index will be excluded from
  63. * tables index list.
  64. *
  65. * @param null|\Doctrine\DBAL\Schema\Index $index
  66. * @return SchemaIndexDefinitionEventArgs
  67. */
  68. public function setIndex(Index $index = null)
  69. {
  70. $this->_index = $index;
  71. return $this;
  72. }
  73. /**
  74. * @return \Doctrine\DBAL\Schema\Index
  75. */
  76. public function getIndex()
  77. {
  78. return $this->_index;
  79. }
  80. /**
  81. * @return array
  82. */
  83. public function getTableIndex()
  84. {
  85. return $this->_tableIndex;
  86. }
  87. /**
  88. * @return string
  89. */
  90. public function getTable()
  91. {
  92. return $this->_table;
  93. }
  94. /**
  95. * @return \Doctrine\DBAL\Connection
  96. */
  97. public function getConnection()
  98. {
  99. return $this->_connection;
  100. }
  101. /**
  102. * @return \Doctrine\DBAL\Platforms\AbstractPlatform
  103. */
  104. public function getDatabasePlatform()
  105. {
  106. return $this->_connection->getDatabasePlatform();
  107. }
  108. }