当前位置: 首页>>代码示例>>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;未经允许,请勿转载。