本文整理汇总了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);
}
示例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()]);
}
示例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);
}
示例4: partition
/** {@inheritDoc} */
public function partition(Closure $p)
{
$this->initialize();
return $this->collection->partition($p);
}
示例5: partition
function partition(\Closure $p)
{
return $this->fields->partition($p);
}