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


PHP ProxyQueryInterface::getQuery方法代碼示例

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


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

示例1: batchDelete

 /**
  * Deletes a set of $class identified by the provided $idx array
  *
  * @param string                                           $class
  * @param \Sonata\AdminBundle\Datagrid\ProxyQueryInterface $queryProxy
  *
  * @return void
  */
 public function batchDelete($class, ProxyQueryInterface $queryProxy)
 {
     try {
         foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
             $this->delete($object[0]);
         }
     } catch (\PDOException $e) {
         throw new ModelManagerException('', 0, $e);
     }
 }
開發者ID:novatex,項目名稱:SonataMediaBundle,代碼行數:18,代碼來源:DoctrineORMManager.php

示例2: batchDelete

 /**
  * {@inheritdoc}
  */
 public function batchDelete($class, ProxyQueryInterface $queryProxy)
 {
     $queryProxy->select('DISTINCT ' . $queryProxy->getRootAlias());
     try {
         $entityManager = $this->getEntityManager($class);
         $i = 0;
         foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
             $entityManager->remove($object[0]);
             if (++$i % 20 == 0) {
                 $entityManager->flush();
                 $entityManager->clear();
             }
         }
         $entityManager->flush();
         $entityManager->clear();
     } catch (\PDOException $e) {
         throw new ModelManagerException('', 0, $e);
     } catch (DBALException $e) {
         throw new ModelManagerException('', 0, $e);
     }
 }
開發者ID:LamaDelRay,項目名稱:test_symf,代碼行數:24,代碼來源:ModelManager.php

示例3: batchDelete

    /**
     * Deletes a set of $class identified by the provided $idx array
     *
     * @param string $class
     * @param array $idx
     * @return void
     */
    public function batchDelete($class, ProxyQueryInterface $queryProxy)
    {
        $i = 0;
        foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
            $this->entityManager->remove($object[0]);

            if ((++$i % 20) == 0) {
                $this->entityManager->flush();
                $this->entityManager->clear();
            }
        }

        $this->entityManager->flush();
        $this->entityManager->clear();
    }
開發者ID:nibsirahsieu,項目名稱:AdminBundle,代碼行數:22,代碼來源:ModelManager.php

示例4: batchDelete

 /**
  * {@inheritdoc}
  */
 public function batchDelete($class, ProxyQueryInterface $queryProxy)
 {
     foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
         $this->delete($object);
     }
 }
開發者ID:sidz,項目名稱:SonataMediaBundle,代碼行數:9,代碼來源:DoctrineMongoDBManager.php

示例5: batchDelete

 /**
  * {@inheritdoc}
  */
 public function batchDelete($class, ProxyQueryInterface $queryProxy)
 {
     /** @var Query $queryBuilder */
     $queryBuilder = $queryProxy->getQuery();
     $documentManager = $this->getDocumentManager($class);
     $i = 0;
     foreach ($queryBuilder->execute() as $object) {
         $documentManager->remove($object);
         if (++$i % 20 == 0) {
             $documentManager->flush();
             $documentManager->clear();
         }
     }
     $documentManager->flush();
     $documentManager->clear();
 }
開發者ID:jdshao,項目名稱:symfony_backstage,代碼行數:19,代碼來源:ModelManager.php

示例6: batchDelete

 /**
  * Deletes a set of $class identified by the provided $idx array
  *
  * @param $class
  * @param \Sonata\AdminBundle\Datagrid\ProxyQueryInterface $queryProxy
  * @return void
  */
 public function batchDelete($class, ProxyQueryInterface $queryProxy)
 {
     try {
         $i = 0;
         foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
             $this->documentManager->remove($object[0]);
             if (++$i % 20 == 0) {
                 $this->documentManager->flush();
                 $this->documentManager->clear();
             }
         }
         $this->documentManager->flush();
         $this->documentManager->clear();
     } catch (\Exception $e) {
         throw new ModelManagerException('', 0, $e);
     }
 }
開發者ID:richardmiller,項目名稱:SonataDoctrinePhpcrAdminBundle,代碼行數:24,代碼來源:ModelManager.php

示例7: batchDelete

 /**
  * @param string                                           $class
  * @param \Sonata\AdminBundle\Datagrid\ProxyQueryInterface $queryProxy
  */
 public function batchDelete($class, ProxyQueryInterface $queryProxy)
 {
     if (count($queryProxy->getQuery()->getMap()) == 0) {
         $queryProxy->deleteAll();
     } else {
         $queryProxy->delete();
     }
 }
開發者ID:kosolapovvp,項目名稱:SonataPropelAdminBundle,代碼行數:12,代碼來源:ModelManager.php

示例8: preBatchAction

 public function preBatchAction($actionName, ProxyQueryInterface $query, array &$idx, $allElements)
 {
     if ($actionName == 'delete') {
         try {
             $test = array();
             foreach ($query->getQuery()->iterate() as $pos => $object) {
                 $url = $object[0]->getUrl();
                 if (file_exists('/var/lib/mpd/' . $url) && in_array($object[0]->getId(), $idx)) {
                     chmod('/var/lib/mpd/' . $url, 0777);
                     if (!unlink('/var/lib/mpd/' . $url)) {
                         die('can\'t unlink');
                     }
                 }
             }
         } catch (\PDOException $e) {
             throw new ModelManagerException('', 0, $e);
         }
     }
 }
開發者ID:Gribanovskiy,項目名稱:symfony_radio,代碼行數:19,代碼來源:SongsAdmin.php

示例9: batchActionDownload

 /**
  * Execute a batch download
  *
  * @param ProxyQueryInterface $query
  *
  * @return RedirectResponse
  */
 public function batchActionDownload(ProxyQueryInterface $queryProxy)
 {
     $flashType = 'success';
     $dumper = new Dumper();
     $dumper->setIndentation(4);
     $response = new StreamedResponse(function () use($queryProxy, &$flashType, $dumper) {
         try {
             /**
              * @var TransUnit $transUnit
              */
             foreach ($queryProxy->getQuery()->iterate() as $pos => $object) {
                 foreach ($object as $transUnit) {
                     $chunkPrefix = $transUnit->getDomain() . '__' . $transUnit->getKey() . '__' . $transUnit->getId() . '__';
                     $chunk = array();
                     /** @var TranslationInterface $translation */
                     foreach ($transUnit->getTranslations() as $translation) {
                         $chunk[$chunkPrefix . $translation->getLocale()] = $translation->getContent();
                     }
                     echo $dumper->dump($chunk, 2);
                     flush();
                 }
             }
         } catch (\PDOException $e) {
             $flashType = 'error';
             flush();
         } catch (DBALException $e) {
             $flashType = 'error';
             flush();
         }
     });
     $this->addFlash('sonata_flash_' . $flashType, 'translations.flash_batch_download_' . $flashType);
     $response->headers->set('Content-Type', 'text/x-yaml');
     $response->headers->set('Cache-Control', '');
     $response->headers->set('Transfer-Encoding', 'chunked');
     $response->headers->set('Last-Modified', gmdate('D, d M Y H:i:s'));
     $contentDisposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, 'translations.yml');
     $response->headers->set('Content-Disposition', $contentDisposition);
     return $response;
 }
開發者ID:helios-ag,項目名稱:IbrowsSonataTranslationBundle,代碼行數:46,代碼來源:TranslationCRUDController.php


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