Geen omschrijving

ObjectRouteLoader.php 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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\Routing\Loader;
  11. @trigger_error(sprintf('The "%s" class is deprecated since Symfony 4.4, use "%s" instead.', ObjectRouteLoader::class, ObjectLoader::class), \E_USER_DEPRECATED);
  12. /**
  13. * A route loader that calls a method on an object to load the routes.
  14. *
  15. * @author Ryan Weaver <ryan@knpuniversity.com>
  16. *
  17. * @deprecated since Symfony 4.4, use ObjectLoader instead.
  18. */
  19. abstract class ObjectRouteLoader extends ObjectLoader
  20. {
  21. /**
  22. * Returns the object that the method will be called on to load routes.
  23. *
  24. * For example, if your application uses a service container,
  25. * the $id may be a service id.
  26. *
  27. * @param string $id
  28. *
  29. * @return object
  30. */
  31. abstract protected function getServiceObject($id);
  32. /**
  33. * {@inheritdoc}
  34. */
  35. public function supports($resource, $type = null)
  36. {
  37. return 'service' === $type;
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. protected function getObject(string $id)
  43. {
  44. return $this->getServiceObject($id);
  45. }
  46. }