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


PHP Entity::initQueryBuilder方法代碼示例

本文整理匯總了PHP中APY\DataGridBundle\Grid\Source\Entity::initQueryBuilder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Entity::initQueryBuilder方法的具體用法?PHP Entity::initQueryBuilder怎麽用?PHP Entity::initQueryBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在APY\DataGridBundle\Grid\Source\Entity的用法示例。


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

示例1: typeAction

 /**
  * Index view of content by type
  *
  * @param int $type
  * @return Response
  */
 public function typeAction($type)
 {
     $contentType = $this->get('opifer.content.content_type_manager')->getRepository()->find($type);
     if (!$contentType) {
         throw $this->createNotFoundException(sprintf('Content Type with ID %d could not be found.', $type));
     }
     $queryBuilder = $this->get('opifer.content.content_manager')->getRepository()->createValuedQueryBuilder('c');
     $source = new Entity($this->getParameter('opifer_content.content_class'));
     $source->initQueryBuilder($queryBuilder);
     $tableAlias = $source->getTableAlias();
     $source->manipulateQuery(function ($query) use($tableAlias, $contentType) {
         $query->andWhere($tableAlias . '.contentType = :contentType')->setParameter('contentType', $contentType);
     });
     $editAction = new RowAction('button.edit', 'opifer_content_contenteditor_design');
     $editAction->setRouteParameters(['id', 'type' => 'content']);
     //$deleteAction = new RowAction('button.delete', 'opifer_content_content_delete');
     //$deleteAction->setRouteParameters(['id']);
     /* @var $grid \APY\DataGridBundle\Grid\Grid */
     $grid = $this->get('grid');
     $grid->setId('content')->setSource($source)->addRowAction($editAction);
     //->addRowAction($deleteAction)
     foreach ($contentType->getSchema()->getAttributes() as $attribute) {
         $name = $attribute->getName();
         $column = new TextColumn(['id' => $name, 'field' => 'attributes.' . $attribute->getName() . '.value', 'title' => $attribute->getDisplayName()]);
         $column->manipulateRenderCell(function ($value, $row, $router) use($name) {
             $value = $row->getEntity()->getAttributes()[$name];
             return $value;
         });
         $grid->addColumn($column);
     }
     return $grid->getGridResponse($this->getParameter('opifer_content.content_type_view'), ['content_type' => $contentType, 'grid' => $grid]);
 }
開發者ID:dzoke,項目名稱:Cms,代碼行數:38,代碼來源:ContentController.php

示例2: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     $source = new Entity('CSBillInvoiceBundle:Invoice');
     $repo = $this->entityManager->getRepository('CSBillInvoiceBundle:Invoice');
     $queryBuilder = $repo->createQueryBuilder('i');
     $queryBuilder->where('i.recurring = 0');
     $source->initQueryBuilder($queryBuilder);
     return $source;
 }
開發者ID:Codixis,項目名稱:CSBill,代碼行數:12,代碼來源:InvoiceGrid.php

示例3: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     $this->entityManager->getFilters()->disable('archivable');
     $source = new Entity('CSBillInvoiceBundle:Invoice');
     /** @var InvoiceRepository $repo */
     $repo = $this->entityManager->getRepository('CSBillInvoiceBundle:Invoice');
     $queryBuilder = $repo->createQueryBuilder('i');
     $queryBuilder->where('i.archived is not null');
     $source->initQueryBuilder($queryBuilder);
     return $source;
 }
開發者ID:Codixis,項目名稱:CSBill,代碼行數:14,代碼來源:InvoiceArchivedGrid.php

示例4: getSource

 /**
  * {@inheritdoc}
  */
 public function getSource()
 {
     $this->objectManager->getFilters()->disable('softdeleteable');
     $source = new Entity('CSBillClientBundle:Client');
     /** @var ClientRepository $repo */
     $repo = $this->objectManager->getRepository('CSBillClientBundle:Client');
     $queryBuilder = $repo->createQueryBuilder('c');
     $queryBuilder->where('c.deletedAt is not null');
     $source->initQueryBuilder($queryBuilder);
     return $source;
 }
開發者ID:Codixis,項目名稱:CSBill,代碼行數:14,代碼來源:ClientDeletedGrid.php

示例5: lister_utilisateurAction

 public function lister_utilisateurAction()
 {
     if (false === $this->get('security.authorization_checker')->isGranted('ROLE_ADMIN') && false === $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
         throw new AccessDeniedException();
     }
     // Creates a simple grid based on your entity (ORM)
     $source = new Entity('ROUtilisateurBundle:Utilisateur');
     // Get a Grid instance
     $grid = $this->get('grid');
     //Récupération du repository utilisateur
     $utilisateurRepository = $this->getDoctrine()->getManager()->getRepository('ROUtilisateurBundle:Utilisateur');
     //Dire au dataGrid que la source sera différente du paramétrage onnataion de l'entité modéle
     $utilisateurQueryBuilder = $utilisateurRepository->loadUserForGrid();
     $source->initQueryBuilder($utilisateurQueryBuilder);
     //Création de la colonne avec les roles concaténé
     $rolesColumn = new TextColumn(array('id' => 'concatNomRole', 'title' => 'Rôles', 'filterable' => false, 'sortable' => false));
     $grid->addColumn($rolesColumn);
     // Attach the source to the grid
     $grid->setSource($source);
     //Création de la possiblité d'exporter le listing au format CSV
     $grid->addExport(new CSVExport('CSV Export', 'Export utilisateur CSV'));
     $grid->addExport(new ExcelExport('XLS Export', 'Export utilisateur XLS'));
     //Message a afficher si la valeur de l'attribut est vide
     $grid->setNoDataMessage(' - ');
     //Message a afficher si le listing ne contient aucune ligne
     $grid->setNoResultMessage('Aucun resultat trouvé');
     //GESTION DES ACTION DE LA COLONNE DE DROITE
     //Ajout de l'action d'ajout utilisateur
     $rowDetailAction = new RowAction('', 'ro_utilisateur_detail', false, '_self', array('class' => 'btn btn-primary'), array('class' => 'glyphicon glyphicon-eye-open', 'title' => 'Détail utilisateur'));
     $grid->addRowAction($rowDetailAction);
     //Ajout de l'action de modification utilisateur
     $rowUpdateAction = new RowAction('', 'ro_utilisateur_edit', false, '_self', array('class' => 'btn btn-success'), array('class' => 'glyphicon glyphicon-edit glyphicon-white', 'title' => 'Modifier utilisateur'));
     $grid->addRowAction($rowUpdateAction);
     //Ajout de l'action de suppression utilisateur
     $rowDeleteAction = new RowAction('', 'ro_utilisateur_delete', true, '_self', array('class' => 'btn btn-danger'), array('class' => 'glyphicon glyphicon-trash glyphicon-white', 'title' => 'Supprimer utilisateur'));
     //Message de confirmation de suppression
     $rowDeleteAction->setConfirmMessage('Etes vous sur de vouloir supprimer cet utilisateur ?');
     $grid->addRowAction($rowDeleteAction);
     //GESTION DES MASS ACTION
     //Mass action,traitement sur plusieur ligne en les cochant,ici on crée un bouton de suppresssion
     $grid->addMassAction(new DeleteMassAction());
     // Return the response of the grid to the template
     return $grid->getGridResponse('ROUtilisateurBundle:utilisateur:lister_utilisateur.html.twig');
 }
開發者ID:ramisg85,項目名稱:oueslatirami,代碼行數:44,代碼來源:utilisateurController.php

示例6: indexAction

 /**
  * Menu index
  *
  * @return Response
  */
 public function indexAction()
 {
     $qb = $this->container->get('opifer.cms.menu_manager')->getRepository()->getNodesHierarchyQueryBuilder();
     $source = new Entity('OpiferCmsBundle:Menu');
     $source->initQueryBuilder($qb);
     $editAction = new RowAction('edit', 'opifer_cms_menu_edit');
     $editAction->setRouteParameters(['id']);
     $deleteAction = new RowAction('delete', 'opifer_cms_menu_delete');
     $deleteAction->setRouteParameters(['id']);
     $grid = $this->get('grid');
     $grid->setId('menus')->setSource($source)->addRowAction($editAction)->addRowAction($deleteAction);
     $grid->getColumn('name')->setSafe(false)->setFilterable(false)->setSortable(false)->manipulateRenderCell(function ($value, $row, $router) {
         $item = $row->getEntity();
         $indentation = $item->getLvl() ? str_repeat(' ', $item->getLvl() * 4) : '';
         if ($item instanceof MenuItem) {
             $route = $router->generate('opifer_cms_menu_edit', ['id' => $item->getId()]);
             $html = $indentation . '<a href="' . $route . '"><span class="text-muted">' . $item->getName() . '</span></a>';
         } else {
             $html = $indentation . '<span class="text-muted">' . $item->getName() . '</span>';
         }
         return $html;
     });
     return $grid->getGridResponse('OpiferCmsBundle:Backend/Menu:index.html.twig');
 }
開發者ID:dzoke,項目名稱:Cms,代碼行數:29,代碼來源:MenuController.php


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