SchemaColumnDefinitionEventArgs.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <?php
  2. namespace Doctrine\DBAL\Event;
  3. use Doctrine\DBAL\Connection;
  4. use Doctrine\DBAL\Platforms\AbstractPlatform;
  5. use Doctrine\DBAL\Schema\Column;
  6. /**
  7. * Event Arguments used when the portable column definition is generated inside Doctrine\DBAL\Schema\AbstractSchemaManager.
  8. */
  9. class SchemaColumnDefinitionEventArgs extends SchemaEventArgs
  10. {
  11. /** @var Column|null */
  12. private $column = null;
  13. /**
  14. * Raw column data as fetched from the database.
  15. *
  16. * @var mixed[]
  17. */
  18. private $tableColumn;
  19. /** @var string */
  20. private $table;
  21. /** @var string */
  22. private $database;
  23. /** @var Connection */
  24. private $connection;
  25. /**
  26. * @param mixed[] $tableColumn
  27. * @param string $table
  28. * @param string $database
  29. */
  30. public function __construct(array $tableColumn, $table, $database, Connection $connection)
  31. {
  32. $this->tableColumn = $tableColumn;
  33. $this->table = $table;
  34. $this->database = $database;
  35. $this->connection = $connection;
  36. }
  37. /**
  38. * Allows to clear the column which means the column will be excluded from
  39. * tables column list.
  40. *
  41. * @return \Doctrine\DBAL\Event\SchemaColumnDefinitionEventArgs
  42. */
  43. public function setColumn(?Column $column = null)
  44. {
  45. $this->column = $column;
  46. return $this;
  47. }
  48. /**
  49. * @return Column|null
  50. */
  51. public function getColumn()
  52. {
  53. return $this->column;
  54. }
  55. /**
  56. * @return mixed[]
  57. */
  58. public function getTableColumn()
  59. {
  60. return $this->tableColumn;
  61. }
  62. /**
  63. * @return string
  64. */
  65. public function getTable()
  66. {
  67. return $this->table;
  68. }
  69. /**
  70. * @return string
  71. */
  72. public function getDatabase()
  73. {
  74. return $this->database;
  75. }
  76. /**
  77. * @return Connection
  78. */
  79. public function getConnection()
  80. {
  81. return $this->connection;
  82. }
  83. /**
  84. * @return AbstractPlatform
  85. */
  86. public function getDatabasePlatform()
  87. {
  88. return $this->connection->getDatabasePlatform();
  89. }
  90. }