当前位置: 首页>>代码示例>>PHP>>正文


PHP Route\RouteCollection类代码示例

本文整理汇总了PHP中Sonata\AdminBundle\Route\RouteCollection的典型用法代码示例。如果您正苦于以下问题:PHP RouteCollection类的具体用法?PHP RouteCollection怎么用?PHP RouteCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RouteCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     // to remove a single route
     $collection->remove('delete');
     // OR remove all route except named ones
     $collection->clearExcept(array('list', 'show'));
 }
开发者ID:WildCodeSchool,项目名称:projet-wildresa,代码行数:7,代码来源:EventsAdmin.php

示例2: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     //$collection->remove('create');
     $collection->remove('delete');
     $collection->remove('export');
     $collection->remove('show');
 }
开发者ID:realburner,项目名称:Sonata-media-upload-multiple-images,代码行数:7,代码来源:FooterWidgetsAdmin.php

示例3: testLoad

 public function testLoad()
 {
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $pool = $this->getMock('Sonata\\AdminBundle\\Admin\\Pool', array(), array($container, 'title', 'logoTitle'));
     $adminPoolLoader = new AdminPoolLoader($pool, array('foo_admin', 'bar_admin'), $container);
     $routeCollection1 = new RouteCollection('base.Code.Route.foo', 'baseRouteNameFoo', 'baseRoutePatternFoo', 'baseControllerNameFoo');
     $routeCollection2 = new RouteCollection('base.Code.Route.bar', 'baseRouteNameBar', 'baseRoutePatternBar', 'baseControllerNameBar');
     $routeCollection1->add('foo');
     $routeCollection2->add('bar');
     $routeCollection2->add('baz');
     $admin1 = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $admin1->expects($this->once())->method('getRoutes')->will($this->returnValue($routeCollection1));
     $admin2 = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $admin2->expects($this->once())->method('getRoutes')->will($this->returnValue($routeCollection2));
     $pool->expects($this->any())->method('getInstance')->will($this->returnCallback(function ($id) use($admin1, $admin2) {
         switch ($id) {
             case 'foo_admin':
                 return $admin1;
             case 'bar_admin':
                 return $admin2;
         }
         return;
     }));
     $collection = $adminPoolLoader->load('foo', 'sonata_admin');
     $this->assertInstanceOf('Symfony\\Component\\Routing\\RouteCollection', $collection);
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $collection->get('baseRouteNameFoo_foo'));
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $collection->get('baseRouteNameBar_bar'));
     $this->assertInstanceOf('Symfony\\Component\\Routing\\Route', $collection->get('baseRouteNameBar_bar'));
 }
开发者ID:clavier-souris,项目名称:SonataAdminBundle,代码行数:29,代码来源:AdminPoolLoaderTest.php

示例4: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     $collection->add('appercu', $this->getRouterIdParameter() . '/appercu');
     $collection->add('sendtest', $this->getRouterIdParameter() . '/sendtest');
     $collection->add('send', $this->getRouterIdParameter() . '/send');
     $collection->add('ajaxsend', $this->getRouterIdParameter() . '/ajaxsend');
 }
开发者ID:saliih,项目名称:yasmine-print,代码行数:7,代码来源:SenderAdmin.php

示例5: configureRoutes

 /**
  * {@inheritdoc}
  */
 protected function configureRoutes(RouteCollection $collection)
 {
     $collection->add('createFromPage', 'create_from_page/root_id/{rootId}/page_id/{pageId}', array(), array('_method' => 'GET|POST', 'rootId', 'pageId'));
     $collection->add('ajaxController', 'ajax_navigation', array(), array('_method' => 'GET|POST'));
     $collection->add('newPlacement', 'new_placement/{newMenuItemId}/{menuItemId}', array(), array('_method' => 'GET|POST', 'newMenuItemId', 'menuItemId'));
     $collection->add('placement', 'placement', array(), array('_method' => 'GET|POST'));
 }
开发者ID:lzdv,项目名称:init-cms-bundle,代码行数:10,代码来源:MenuItemAdmin.php

示例6: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     $collection->add('import');
     // Action gets added automatically
     $collection->add('view', $this->getRouterIdParameter() . '/view');
     //        $collection->remove('create');
 }
开发者ID:Nexotap,项目名称:Ivory,代码行数:7,代码来源:PaymentTermAdmin.php

示例7: configureRoutes

 public function configureRoutes(RouteCollection $collection)
 {
     $collection->remove('edit');
     //remove all route except named ones
     //$collection->clearExcept(array('list', 'create', 'delete'));
     $collection->add('downloadFile', $this->getRouterIdParameter() . '/download');
 }
开发者ID:morustechnology,项目名称:LmcAdmissionBundle,代码行数:7,代码来源:ImportLogAdmin.php

示例8: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     if (!$this->isDevelopment()) {
         // Remove delete route in production env
         $collection->remove('delete');
     }
 }
开发者ID:bamper,项目名称:symfony-ecommerce,代码行数:7,代码来源:ConfigurationAdmin.php

示例9: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     $collection->add('delivered');
     $collection->add('open');
     $collection->add('print');
     $collection->remove('create');
 }
开发者ID:DevMaster112,项目名称:flora,代码行数:7,代码来源:DistributionAdmin.php

示例10: configureRoutes

 public function configureRoutes(RouteCollection $collection)
 {
     $collection->add('ProductUpload');
     // add custom action name which you created in controller for which you want to generate route.
     $collection->remove('delete');
     //$collection->remove('list');
 }
开发者ID:manudatta12,项目名称:POC,代码行数:7,代码来源:manageFileSystemAdmin.php

示例11: testBuildWithChildren

 public function testBuildWithChildren()
 {
     $audit = $this->getMock('Sonata\\AdminBundle\\Model\\AuditManagerInterface');
     $audit->expects($this->once())->method('hasReader')->will($this->returnValue(true));
     $childRouteCollection1 = new RouteCollection('child1.Code.Route', 'child1RouteName', 'child1RoutePattern', 'child1ControllerName');
     $childRouteCollection1->add('foo');
     $childRouteCollection1->add('bar');
     $childRouteCollection2 = new RouteCollection('child2.Code.Route', 'child2RouteName', 'child2RoutePattern', 'child2ControllerName');
     $childRouteCollection2->add('baz');
     $child1 = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $child1->expects($this->once())->method('getRoutes')->will($this->returnValue($childRouteCollection1));
     $child2 = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $child2->expects($this->once())->method('getRoutes')->will($this->returnValue($childRouteCollection2));
     $admin = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $admin->expects($this->once())->method('getParent')->will($this->returnValue(null));
     $admin->expects($this->once())->method('getChildren')->will($this->returnValue(array($child1, $child2)));
     $admin->expects($this->once())->method('isAclEnabled')->will($this->returnValue(true));
     $routeCollection = new RouteCollection('base.Code.Route', 'baseRouteName', 'baseRoutePattern', 'baseControllerName');
     $pathBuilder = new QueryStringBuilder($audit);
     $pathBuilder->build($admin, $routeCollection);
     $expectedRoutes = array('list', 'create', 'batch', 'edit', 'delete', 'show', 'export', 'history', 'history_view_revision', 'acl', 'child1.Code.Route.foo', 'child1.Code.Route.bar', 'child2.Code.Route.baz');
     $this->assertCount(count($expectedRoutes), $routeCollection->getElements());
     foreach ($expectedRoutes as $expectedRoute) {
         $this->assertTrue($routeCollection->has($expectedRoute), sprintf('Expected route: "%s" doesn`t exist.', $expectedRoute));
     }
 }
开发者ID:r1pp3rj4ck,项目名称:SonataAdminBundle,代码行数:26,代码来源:QueryStringBuilderTest.php

示例12: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     $collection->add('import');
     // Suffix Action gets added automatically eg. this becomes importAction
     $collection->add('view', $this->getRouterIdParameter() . '/view');
     $collection->add('importProcess');
 }
开发者ID:Nexotap,项目名称:Ivory,代码行数:7,代码来源:ProductAdmin.php

示例13: addCollection

 /**
  * @param RouteCollection $collection
  *
  * @return \Sonata\AdminBundle\Route\RouteCollection
  */
 public function addCollection(RouteCollection $collection)
 {
     foreach ($collection->getElements() as $code => $route) {
         $this->elements[$code] = $route;
     }
     return $this;
 }
开发者ID:saberyounis,项目名称:Sonata-Project,代码行数:12,代码来源:RouteCollection.php

示例14: setUp

 protected function setUp()
 {
     $this->application = new Application();
     $command = new ExplainAdminCommand();
     $container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
     $this->admin = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $this->admin->expects($this->any())->method('getCode')->will($this->returnValue('foo'));
     $this->admin->expects($this->any())->method('getClass')->will($this->returnValue('Acme\\Entity\\Foo'));
     $this->admin->expects($this->any())->method('getBaseControllerName')->will($this->returnValue('SonataAdminBundle:CRUD'));
     $routeCollection = new RouteCollection('foo', 'fooBar', 'foo-bar', 'SonataAdminBundle:CRUD');
     $routeCollection->add('list');
     $routeCollection->add('edit');
     $this->admin->expects($this->any())->method('getRoutes')->will($this->returnValue($routeCollection));
     $fieldDescription1 = $this->getMock('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface');
     $fieldDescription1->expects($this->any())->method('getType')->will($this->returnValue('text'));
     $fieldDescription1->expects($this->any())->method('getTemplate')->will($this->returnValue('SonataAdminBundle:CRUD:foo_text.html.twig'));
     $fieldDescription2 = $this->getMock('Sonata\\AdminBundle\\Admin\\FieldDescriptionInterface');
     $fieldDescription2->expects($this->any())->method('getType')->will($this->returnValue('datetime'));
     $fieldDescription2->expects($this->any())->method('getTemplate')->will($this->returnValue('SonataAdminBundle:CRUD:bar_datetime.html.twig'));
     $this->admin->expects($this->any())->method('getListFieldDescriptions')->will($this->returnValue(array('fooTextField' => $fieldDescription1, 'barDateTimeField' => $fieldDescription2)));
     $this->admin->expects($this->any())->method('getFilterFieldDescriptions')->will($this->returnValue(array('fooTextField' => $fieldDescription1, 'barDateTimeField' => $fieldDescription2)));
     $this->admin->expects($this->any())->method('getFormTheme')->will($this->returnValue(array('FooBundle::bar.html.twig')));
     $this->admin->expects($this->any())->method('getFormFieldDescriptions')->will($this->returnValue(array('fooTextField' => $fieldDescription1, 'barDateTimeField' => $fieldDescription2)));
     $this->admin->expects($this->any())->method('isChild')->will($this->returnValue(true));
     // php 5.3 BC
     $adminParent = $this->getMock('Sonata\\AdminBundle\\Admin\\AdminInterface');
     $adminParent->expects($this->any())->method('getCode')->will($this->returnValue('foo_child'));
     $this->admin->expects($this->any())->method('getParent')->will($this->returnCallback(function () use($adminParent) {
         return $adminParent;
     }));
     // Prefer Symfony 2.x interfaces
     if (interface_exists('Symfony\\Component\\Validator\\MetadataFactoryInterface')) {
         $this->validatorFactory = $this->getMock('Symfony\\Component\\Validator\\MetadataFactoryInterface');
         $validator = $this->getMock('Symfony\\Component\\Validator\\ValidatorInterface');
         $validator->expects($this->any())->method('getMetadataFactory')->will($this->returnValue($this->validatorFactory));
     } else {
         $this->validatorFactory = $this->getMock('Symfony\\Component\\Validator\\Mapping\\Factory\\MetadataFactoryInterface');
         $validator = $this->getMock('Symfony\\Component\\Validator\\Validator\\ValidatorInterface');
         $validator->expects($this->any())->method('getMetadataFor')->will($this->returnValue($this->validatorFactory));
     }
     // php 5.3 BC
     $admin = $this->admin;
     $container->expects($this->any())->method('get')->will($this->returnCallback(function ($id) use($container, $admin, $validator) {
         switch ($id) {
             case 'sonata.admin.pool':
                 $pool = new Pool($container, '', '');
                 $pool->setAdminServiceIds(array('acme.admin.foo', 'acme.admin.bar'));
                 return $pool;
             case 'validator':
                 return $validator;
             case 'acme.admin.foo':
                 return $admin;
         }
         return;
     }));
     $command->setContainer($container);
     $this->application->add($command);
 }
开发者ID:ruslan-polutsygan,项目名称:SonataAdminBundle,代码行数:58,代码来源:ExplainAdminCommandTest.php

示例15: configureRoutes

 protected function configureRoutes(RouteCollection $collection)
 {
     // on top
     $collection->add('crawl-indexes', 'crawl-indexes');
     $collection->add('crawl-links', 'crawl-links');
     $collection->add('crawl-url', 'crawl-url');
     // on list
     $collection->add('crawl-link', $this->getRouterIdParameter() . '/crawl');
 }
开发者ID:NadirZenith,项目名称:CrawlerBundle,代码行数:9,代码来源:LinkAdmin.php


注:本文中的Sonata\AdminBundle\Route\RouteCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。