當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Datagrid\DatagridMapper類代碼示例

本文整理匯總了PHP中Sonata\AdminBundle\Datagrid\DatagridMapper的典型用法代碼示例。如果您正苦於以下問題:PHP DatagridMapper類的具體用法?PHP DatagridMapper怎麽用?PHP DatagridMapper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了DatagridMapper類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: configureDatagridFilters

 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  *
  * @return void
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $container = $this->getConfigurationPool()->getContainer();
     $entityManager = $container->get('doctrine.orm.default_entity_manager');
     $datagridMapper->add('locale', 'doctrine_orm_callback', ['label' => 'Langue', 'callback' => function (ProxyQuery $queryBuilder, $alias, $field, $value) {
         if (!$value['value']) {
             return false;
         }
         $queryBuilder->andWhere($alias . '.locale = :locale')->setParameter('locale', $value['value']);
         return true;
     }], 'choice', ['choices' => $this->getRealLocales()])->add('title', null, ['label' => 'Page'])->add('published', null, ['label' => 'Publié'])->add('node', 'doctrine_orm_callback', ['label' => 'Type de contenu', 'callback' => function (ProxyQuery $queryBuilder, $alias, $field, $value) use($entityManager) {
         if (!$value['value']) {
             return false;
         }
         // We can't query the type from the AlpixelCMSBundle:Node repository (InheritanceType) because of that
         // we try to get the repository in AppBundle with the value which is the class name of entity. :pig:
         try {
             $repository = $entityManager->getRepository(sprintf('AppBundle:%s', ucfirst($value['value'])));
         } catch (\Doctrine\Common\Persistence\Mapping\MappingException $e) {
             return false;
         }
         $data = $repository->findAll();
         if (empty($data)) {
             return false;
         }
         $queryBuilder->andWhere($alias . '.id IN (:ids)')->setParameter('ids', $data);
         return true;
     }], 'choice', ['choices' => $this->getCMSEntityTypes()]);
 }
開發者ID:alpixel,項目名稱:AlpixelCMSBundle,代碼行數:34,代碼來源:AdminNode.php

示例2: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $container = $this->getConfigurationPool()->getContainer();
     $roles = $container->getParameter('security.role_hierarchy.roles');
     $rolesChoices = self::flattenRoles($roles);
     $datagridMapper->add('username')->add('firstname')->add('lastname');
 }
開發者ID:bricegates,項目名稱:cba_trainning.com,代碼行數:7,代碼來源:UserAdmin.php

示例3: configureDatagridFilters

 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $filter)
 {
     $filter->add('current')->add('type', null, array(), 'sonata_customer_address_types', array('translation_domain' => 'SonataCustomerBundle'));
     if (!$this->isChild()) {
         $filter->add('customer');
     }
 }
開發者ID:saberyounis,項目名稱:Sonata-Project,代碼行數:10,代碼來源:AddressAdmin.php

示例4: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper
         ->add('title', 'doctrine_phpcr_string')
         ->add('name',  'doctrine_phpcr_nodename')
     ;
 }
開發者ID:xxspartan16,項目名稱:BMS-Market,代碼行數:7,代碼來源:StaticContentAdmin.php

示例5: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('id', null, array('label' => 'order_id'));
     if (!$this->isChild()) {
         $datagridMapper->add('partner', null, array('label' => 'customer'));
     }
 }
開發者ID:Nexotap,項目名稱:Ivory,代碼行數:7,代碼來源:SaleOrderAdmin.php

示例6: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $commentSettings = $this->getConfigurationPool()->getContainer()->getParameter('comment_settings');
     $commentTypeChoice = $commentSettings['commenttypes'];
     $datagridMapper->add('title')->add('commentType', 'doctrine_orm_string', array(), 'choice', array('choices' => $commentTypeChoice))->add('blogPost')->add('created', 'doctrine_orm_date_range', array('input_type' => 'date'), 'sonata_type_date_range')->add('username')->add('approved', 'doctrine_orm_string', array(), 'choice', array('choices' => array('0' => 'Hide', '1' => 'Show')));
 }
開發者ID:elom5000,項目名稱:BardisCMS,代碼行數:7,代碼來源:CommentAdmin.php

示例7: configureDatagridFilters

 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper, $context = '')
 {
     $datagridMapper->add('name', 'networking_init_cms_simple_string')->add('enabled', null, array('hidden' => true));
     if ($context) {
         $datagridMapper->add('context', null, array('hidden' => true));
     }
 }
開發者ID:lzdv,項目名稱:init-cms-bundle,代碼行數:10,代碼來源:GalleryAdmin.php

示例8: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $em = $this->modelManager->getEntityManager('Vidal\\MainBundle\\Entity\\User');
     $cityChoices = $em->getRepository('VidalMainBundle:City')->getChoices();
     $regionChoices = $em->getRepository('VidalMainBundle:Region')->getChoices();
     $countryChoices = $em->getRepository('VidalMainBundle:Country')->getChoices();
     $datagridMapper->add('id')->add('username', null, array('label' => 'E-mail'))->add('lastName', null, array('label' => 'Фамилия'))->add('primarySpecialty', null, array('label' => 'Основная специальность'))->add('city', 'doctrine_orm_choice', array('label' => 'Город'), 'choice', array('choices' => $cityChoices))->add('region', 'doctrine_orm_choice', array('label' => 'Область'), 'choice', array('choices' => $regionChoices))->add('country', 'doctrine_orm_choice', array('label' => 'Страна'), 'choice', array('choices' => $countryChoices))->add('emailConfirmed', null, array('label' => 'e-mail подтвержден'))->add('oldUser', null, array('label' => 'Со старого сайта'))->add('confirmationHas', null, array('label' => 'Со сканами'));
 }
開發者ID:Evrika,項目名稱:Vidal,代碼行數:8,代碼來源:UserAdmin.php

示例9: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $tagSettings = $this->getConfigurationPool()->getContainer()->getParameter('tag_settings');
     // Setting up the available tag categories and preffered choice
     $tagcategoriesChoices = $tagSettings['tagcategories'];
     $datagridMapper->add('title')->add('tagCategory', 'doctrine_orm_string', array(), 'choice', array('choices' => $tagcategoriesChoices));
 }
開發者ID:elom5000,項目名稱:BardisCMS,代碼行數:8,代碼來源:TagAdmin.php

示例10: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('quizset')->add('content')->add('type');
     //    ->add('quizset','many_to_one', array())
     //    ->add('dateStart','doctrine_orm_datetime', array('label' => 'Data startu'))
     //    ->add('dateEnd', 'doctrine_orm_datetime', array('label' => 'Data końca'))
     //;
 }
開發者ID:przemekkot,項目名稱:Quiz-App-Symfony-Kata,代碼行數:8,代碼來源:QuestionAdmin.php

示例11: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $contentblockSettings = $this->getConfigurationPool()->getContainer()->getParameter('contentblock_settings');
     // Setting up the available content types and preffered choice
     $contentTypeChoices = $contentblockSettings['contenttypes'];
     $datagridMapper->add('title')->add('availability', 'doctrine_orm_string', array(), 'choice', array('choices' => array('page' => 'Page Only', 'global' => 'Global')))->add('publishState', 'doctrine_orm_string', array(), 'choice', array('choices' => array('0' => 'Unpublished', '1' => 'Published')))->add('contentType', 'doctrine_orm_string', array(), 'choice', array('choices' => $contentTypeChoices))->add('className');
 }
開發者ID:elom5000,項目名稱:BardisCMS,代碼行數:8,代碼來源:ContentBlockAdmin.php

示例12: configureDatagridFilters

 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     // Getting the container parameters set in the config file that exist
     $skeletonSettings = $this->getConfigurationPool()->getContainer()->getParameter('skeleton_settings');
     // Setting up the available page types and preffered choice
     $pagetypeChoices = $skeletonSettings['pagetypes'];
     $datagridMapper->add('title')->add('publishState', 'doctrine_orm_string', array(), 'choice', array('choices' => array('0' => 'Unpublished', '1' => 'Published', '2' => 'Preview')))->add('pagetype', 'doctrine_orm_string', array(), 'choice', array('choices' => $pagetypeChoices))->add('categories')->add('tags')->add('author')->add('date', 'doctrine_orm_date_range', array('input_type' => 'date'), 'sonata_type_date_range');
 }
開發者ID:elom5000,項目名稱:BardisCMS,代碼行數:8,代碼來源:SkeletonAdmin.php

示例13: configureDatagridFilters

 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('id');
     if (interface_exists('Sonata\\ClassificationBundle\\Model\\CategoryInterface')) {
         $datagridMapper->add('category');
     }
     $datagridMapper->add('permalink')->add('isCommentable');
 }
開發者ID:saberyounis,項目名稱:Sonata-Project,代碼行數:11,代碼來源:ThreadAdmin.php

示例14: configureDatagridFilters

 /**
  * {@inheritdoc}
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $options = array();
     if (1 === $this->getPersistentParameter('hide_context')) {
         $options['disabled'] = true;
     }
     $datagridMapper->add('context', null, array(), null, $options);
 }
開發者ID:kazak,項目名稱:forum,代碼行數:11,代碼來源:ContextAwareAdmin.php

示例15: configureDatagridFilters

 /**
  * @param \Sonata\AdminBundle\Datagrid\DatagridMapper $datagridMapper
  * @return void
  */
 protected function configureDatagridFilters(DatagridMapper $datagridMapper)
 {
     $datagridMapper->add('name')->add('providerReference')->add('enabled')->add('context');
     $providers = array();
     foreach ($this->pool->getProviderNamesByContext('default') as $name) {
         $providers[$name] = $name;
     }
     $datagridMapper->add('providerName', 'doctrine_orm_choice', array('field_options' => array('choices' => $providers, 'required' => false, 'multiple' => false, 'expanded' => false), 'field_type' => 'choice'));
 }
開發者ID:helmer,項目名稱:SonataMediaBundle,代碼行數:13,代碼來源:MediaAdmin.php


注:本文中的Sonata\AdminBundle\Datagrid\DatagridMapper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。