當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。