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


PHP ArrayCollection::partition方法代码示例

本文整理汇总了PHP中Doctrine\Common\Collections\ArrayCollection::partition方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayCollection::partition方法的具体用法?PHP ArrayCollection::partition怎么用?PHP ArrayCollection::partition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Doctrine\Common\Collections\ArrayCollection的用法示例。


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

示例1: partition

 public function partition(Closure $p)
 {
     if (null === $this->entries) {
         $this->__load___();
     }
     return $this->entries->partition($p);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:7,代码来源:AggregateEntryCollection.php

示例2: getBaskets

 /**
  * Fetchs current user baskets
  *
  * @param  Application $app
  * @param  Request     $request
  * @return Response
  */
 public function getBaskets(Application $app, Request $request)
 {
     $selectedBasketId = trim($request->get('courChuId', ''));
     $baskets = new ArrayCollection($app['EM']->getRepository('Phraseanet:Basket')->findActiveByUser($app['authentication']->getUser()));
     $selectedBasket = null;
     if ('' === $selectedBasketId && $baskets->count() > 0) {
         $selectedBasketId = $baskets->first()->getId();
     }
     if ('' !== $selectedBasketId) {
         $selectedBasket = $app['converter.basket']->convert($selectedBasketId);
         $app['acl.basket']->isOwner($selectedBasket, $app['authentication']->getUser());
     }
     $basketCollections = $baskets->partition(function ($key, $basket) {
         return null !== $basket->getPusher();
     });
     return $app['twig']->render('client/baskets.html.twig', ['total_baskets' => $baskets->count(), 'user_baskets' => $basketCollections[1], 'recept_user_basket' => $basketCollections[0], 'selected_basket' => $selectedBasket, 'selected_basket_elements' => $selectedBasket ? $selectedBasket->getElements() : new ArrayCollection()]);
 }
开发者ID:romainneutron,项目名称:Phraseanet,代码行数:24,代码来源:Baskets.php

示例3: partition

 /**
  * Partitions this collection in two collections according to a predicate.
  * Keys are preserved in the resulting collections.
  *
  * @param Closure $p The predicate on which to partition.
  *
  * @return array An array with two elements. The first element contains the collection
  *               of elements where the predicate returned TRUE, the second element
  *               contains the collection of elements where the predicate returned FALSE.
  */
 public function partition(Closure $p)
 {
     return $this->collection->partition($p);
 }
开发者ID:Rybbow,项目名称:x-blog,代码行数:14,代码来源:ImmutableCollection.php

示例4: partition

 /** {@inheritDoc} */
 public function partition(Closure $p)
 {
     $this->initialize();
     return $this->collection->partition($p);
 }
开发者ID:nikophil,项目名称:cmf-tests,代码行数:6,代码来源:PersistentCollection.php

示例5: partition

 function partition(\Closure $p)
 {
     return $this->fields->partition($p);
 }
开发者ID:tomaszhanc,项目名称:form-field-bundle,代码行数:4,代码来源:FieldCollection.php


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