Drupal investigation

ScopeCrossingInjectionException.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\DependencyInjection\Exception;
  11. /**
  12. * This exception is thrown when the a scope crossing injection is detected.
  13. *
  14. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  15. */
  16. class ScopeCrossingInjectionException extends RuntimeException
  17. {
  18. private $sourceServiceId;
  19. private $sourceScope;
  20. private $destServiceId;
  21. private $destScope;
  22. public function __construct($sourceServiceId, $sourceScope, $destServiceId, $destScope, \Exception $previous = null)
  23. {
  24. parent::__construct(sprintf(
  25. 'Scope Crossing Injection detected: The definition "%s" references the service "%s" which belongs to another scope hierarchy. '
  26. .'This service might not be available consistently. Generally, it is safer to either move the definition "%s" to scope "%s", or '
  27. .'declare "%s" as a child scope of "%s". If you can be sure that the other scope is always active, you can set the reference to strict=false to get rid of this error.',
  28. $sourceServiceId,
  29. $destServiceId,
  30. $sourceServiceId,
  31. $destScope,
  32. $sourceScope,
  33. $destScope
  34. ), 0, $previous);
  35. $this->sourceServiceId = $sourceServiceId;
  36. $this->sourceScope = $sourceScope;
  37. $this->destServiceId = $destServiceId;
  38. $this->destScope = $destScope;
  39. }
  40. public function getSourceServiceId()
  41. {
  42. return $this->sourceServiceId;
  43. }
  44. public function getSourceScope()
  45. {
  46. return $this->sourceScope;
  47. }
  48. public function getDestServiceId()
  49. {
  50. return $this->destServiceId;
  51. }
  52. public function getDestScope()
  53. {
  54. return $this->destScope;
  55. }
  56. }