Column.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Setup\Declaration\Schema\Dto;
  7. /**
  8. * Column structural element.
  9. */
  10. class Column extends GenericElement implements
  11. ElementInterface,
  12. TableElementInterface
  13. {
  14. /**
  15. * Element type.
  16. */
  17. const TYPE = 'column';
  18. /**
  19. * @var Table
  20. */
  21. private $table;
  22. /**
  23. * @var null|string
  24. */
  25. private $onCreate;
  26. /**
  27. * @var string
  28. */
  29. private $comment;
  30. /**
  31. * Constructor.
  32. *
  33. * @param string $name
  34. * @param string $type
  35. * @param Table $table
  36. * @param string $comment
  37. * @param string|null $onCreate
  38. */
  39. public function __construct(
  40. string $name,
  41. string $type,
  42. Table $table,
  43. string $comment = null,
  44. string $onCreate = null
  45. ) {
  46. parent::__construct($name, $type);
  47. $this->table = $table;
  48. $this->onCreate = $onCreate;
  49. $this->comment = $comment;
  50. }
  51. /**
  52. * Retrieve table name.
  53. *
  54. * @return Table
  55. */
  56. public function getTable()
  57. {
  58. return $this->table;
  59. }
  60. /**
  61. * @inheritdoc
  62. */
  63. public function getElementType()
  64. {
  65. return self::TYPE;
  66. }
  67. /**
  68. * Get On Create statement.
  69. *
  70. * @return null|string
  71. */
  72. public function getOnCreate()
  73. {
  74. return $this->onCreate;
  75. }
  76. /**
  77. * {@inheritdoc}
  78. */
  79. public function getComment()
  80. {
  81. return $this->comment;
  82. }
  83. }