DropReference.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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\Operations;
  7. use Magento\Framework\Setup\Declaration\Schema\ElementHistory;
  8. use Magento\Framework\Setup\Declaration\Schema\OperationInterface;
  9. /**
  10. * Drop foreign key operation.
  11. */
  12. class DropReference implements OperationInterface
  13. {
  14. /**
  15. * Operation name.
  16. */
  17. const OPERATION_NAME = 'drop_reference';
  18. /**
  19. * @var DropElement
  20. */
  21. private $dropElement;
  22. /**
  23. * Constructor.
  24. *
  25. * @param DropElement $dropElement
  26. */
  27. public function __construct(DropElement $dropElement)
  28. {
  29. $this->dropElement = $dropElement;
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function isOperationDestructive()
  35. {
  36. return true;
  37. }
  38. /**
  39. * @inheritdoc
  40. */
  41. public function getOperationName()
  42. {
  43. return self::OPERATION_NAME;
  44. }
  45. /**
  46. * @inheritdoc
  47. */
  48. public function doOperation(ElementHistory $elementHistory)
  49. {
  50. return $this->dropElement->doOperation($elementHistory);
  51. }
  52. }