ParentAdminInterface.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /*
  3. * This file is part of the Sonata Project package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  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 Sonata\AdminBundle\Admin;
  11. /**
  12. * This interface can be used to implement an admin that can have children
  13. * admins, meaning admin that correspond to objects with a relationship with
  14. * the object managed by this admin.
  15. *
  16. * @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
  17. */
  18. interface ParentAdminInterface
  19. {
  20. /**
  21. * add an Admin child to the current one.
  22. *
  23. * @param AdminInterface $child
  24. */
  25. public function addChild(AdminInterface $child);
  26. /**
  27. * Returns true or false if an Admin child exists for the given $code.
  28. *
  29. * @param string $code Admin code
  30. *
  31. * @return bool True if child exist, false otherwise
  32. */
  33. public function hasChild($code);
  34. /**
  35. * Returns an collection of admin children.
  36. *
  37. * @return array list of Admin children
  38. */
  39. public function getChildren();
  40. /**
  41. * Returns an admin child with the given $code.
  42. *
  43. * @param string $code
  44. *
  45. * @return AdminInterface|null
  46. */
  47. public function getChild($code);
  48. }