QueryStringBuilder.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /*
  3. * This file is part of the Sonata 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. */
  11. namespace Sonata\AdminBundle\Route;
  12. use Sonata\AdminBundle\Builder\RouteBuilderInterface;
  13. use Sonata\AdminBundle\Admin\AdminInterface;
  14. class QueryStringBuilder implements RouteBuilderInterface
  15. {
  16. /**
  17. * @param \Sonata\AdminBundle\Admin\AdminInterface $admin
  18. * @param \Sonata\AdminBundle\Route\RouteCollection $collection
  19. */
  20. function build(AdminInterface $admin, RouteCollection $collection)
  21. {
  22. $collection->add('list');
  23. $collection->add('create');
  24. $collection->add('batch');
  25. $collection->add('edit');
  26. $collection->add('delete');
  27. $collection->add('show');
  28. // add children urls
  29. foreach ($admin->getChildren() as $children) {
  30. $collection->addCollection($children->getRoutes());
  31. }
  32. }
  33. }