Context.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Model\ResourceModel\Db;
  7. /**
  8. * Constructor modification point for Magento\Framework\Model\ResourceModel\Db\AbstractDb.
  9. *
  10. * All context classes were introduced to allow for backwards compatible constructor modifications
  11. * of classes that were supposed to be extended by extension developers.
  12. *
  13. * Do not call methods of this class directly.
  14. *
  15. * As Magento moves from inheritance-based APIs all such classes will be deprecated together with
  16. * the classes they were introduced for.
  17. *
  18. * @codeCoverageIgnore
  19. */
  20. class Context implements \Magento\Framework\ObjectManager\ContextInterface
  21. {
  22. /**
  23. * @var \Magento\Framework\App\ResourceConnection
  24. */
  25. protected $resources;
  26. /**
  27. * @var TransactionManagerInterface
  28. */
  29. protected $transactionManager;
  30. /**
  31. * @var ObjectRelationProcessor
  32. */
  33. protected $objectRelationProcessor;
  34. /**
  35. * @param \Magento\Framework\App\ResourceConnection $resource
  36. * @param TransactionManagerInterface $transactionManager
  37. * @param ObjectRelationProcessor $objectRelationProcessor
  38. */
  39. public function __construct(
  40. \Magento\Framework\App\ResourceConnection $resource,
  41. TransactionManagerInterface $transactionManager,
  42. ObjectRelationProcessor $objectRelationProcessor
  43. ) {
  44. $this->transactionManager = $transactionManager;
  45. $this->resources = $resource;
  46. $this->objectRelationProcessor = $objectRelationProcessor;
  47. }
  48. /**
  49. * @return \Magento\Framework\App\ResourceConnection
  50. */
  51. public function getResources()
  52. {
  53. return $this->resources;
  54. }
  55. /**
  56. * @return TransactionManagerInterface
  57. */
  58. public function getTransactionManager()
  59. {
  60. return $this->transactionManager;
  61. }
  62. /**
  63. * @return ObjectRelationProcessor
  64. */
  65. public function getObjectRelationProcessor()
  66. {
  67. return $this->objectRelationProcessor;
  68. }
  69. }