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


PHP ArrayCollection::last方法代码示例

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


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

示例1: last

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

示例2: getServiceEvent

 /**
  *
  * @return ServiceEvent
  */
 public function getServiceEvent()
 {
     if (!$this->serviceEvents) {
         $serviceEvent = new ServiceEvent();
         $this->setServiceEvent($serviceEvent);
     }
     return $this->serviceEvents->last();
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:12,代码来源:ServiceEventTrait.php

示例3: append

 public function append($output, $error)
 {
     $processOutput = new ProcessOutput();
     $last = $this->outputs->last();
     $processOutput->setNumber($last ? ++$last->number : 1);
     $processOutput->setCreated(new \DateTime());
     $processOutput->setValue($output);
     $processOutput->setError($error);
     $processOutput->setProcess($this);
     $this->outputs[] = $processOutput;
 }
开发者ID:rixxi,项目名称:watch-process,代码行数:11,代码来源:Process.php

示例4: __construct

 /**
  * @param string
  * @param string
  * @param array	 	 
  */
 public function __construct($departure, $arrival, array $steps = array())
 {
     $this->departure = (string) $departure;
     $this->arrival = (string) $arrival;
     $this->steps = new ArrayCollection();
     foreach ($steps as $step) {
         $this->addStep($step);
     }
     if ($this->steps->last() != NULL) {
         $this->lastSequenceOrder = $this->steps->last()->sequenceOrder;
     }
 }
开发者ID:jff15,项目名称:travelbot,代码行数:17,代码来源:Trip.php

示例5: getSessions

 public function getSessions(Event $event)
 {
     $sessions = new ArrayCollection();
     $this->crawler->filter('#snippet--program dt')->each(function (Crawler $dt) use($sessions, $event) {
         $session = new Session();
         $session->setEvent($event);
         $time = new \DateTime($dt->text(), new \DateTimeZone('Europe/Prague'));
         $date = clone $event->getStart();
         $date->setTime($time->format('H'), $time->format('i'), $time->format('s'));
         $session->setStart($date);
         if ($previousSession = $sessions->last()) {
             $previousSession->setStop($date);
         }
         $sessions->add($session);
     });
     $this->crawler->filter('#snippet--program dd')->each(function (Crawler $dd, $i) use($sessions) {
         $session = $sessions[$i];
         if (preg_match('/program-type-([^ ]+)/', $dd->attr('class'), $matches)) {
             $session->setType($matches[1]);
         }
         $title = $dd->filter('.program-title');
         $speaker = $dd->filter('.program-speaker');
         $description = $dd->filter('.program-desc');
         if (count($title)) {
             $session->setTitle(trim($title->text()));
         }
         if (count($speaker)) {
             $session->setSpeaker(trim($speaker->text()));
         }
         if (count($description)) {
             $session->setDescription(trim($description->text()));
         }
     });
     return $sessions;
 }
开发者ID:webuni,项目名称:srazy-api-client,代码行数:35,代码来源:EventPage.php

示例6: getQBAliasReference

 public function getQBAliasReference($class, $attribute = NULL)
 {
     if (!is_object($class)) {
         throw new \Exception("object must be of type object, type %s given.", gettype($class));
     }
     $class_name = get_class($class);
     // get alias of class
     $alias = NULL;
     foreach ($this->qb_alias_reference->toArray() as $_class => $_alias) {
         if (isset($_alias[$class_name])) {
             $alias = $_alias[$class_name];
         }
     }
     // if not found
     if ($alias === NULL) {
         // if empty, set new
         if ($this->qb_alias_reference->count() == 0) {
             $alias = 'a';
             // get last and then count up
         } else {
             $lastAlias = $this->qb_alias_reference->last();
             $alias = ++$lastAlias[key($lastAlias)];
         }
         // add new
         $this->qb_alias_reference->add(array($class_name => $alias));
     }
     return $attribute === NULL ? $alias : $alias . '.' . $attribute;
 }
开发者ID:RSSfeed,项目名称:AdminBundle,代码行数:28,代码来源:AdminSearch.php

示例7: isUnread

 /**
  * Gets whether the user has read this thread since the last post
  *
  * @param User $user
  *
  * @return boolean
  */
 public function isUnread(User $user)
 {
     if ($this->posts->count() === 0) {
         return false;
     }
     return $this->posts->last()->isUnread($user);
 }
开发者ID:madrakio,项目名称:streamperk-forum-bundle,代码行数:14,代码来源:ForumThread.php

示例8: indexAction

 public function indexAction(Application $app, Request $request, $url)
 {
     if ($url) {
         $urlParts = new ArrayCollection(explode('/', $url));
         $last = $urlParts->last();
         $page = $app['em']->getRepository('CMSilex\\Entities\\Page')->findOneBy(['slug' => $last]);
         if ($page) {
             $template = $page->getTemplate();
             return $app->render('@theme/' . $template . '.html.twig', ['page' => $page]);
         } else {
             throw new NotFoundHttpException();
         }
     }
     throw new NotFoundHttpException();
 }
开发者ID:cmsilex,项目名称:cmsilex,代码行数:15,代码来源:FrontendController.php

示例9: getCurrentStationState

 /**
  * @return StationState
  */
 public function getCurrentStationState()
 {
     return $this->stationStates->last();
 }
开发者ID:alexcarol,项目名称:bicing-stats,代码行数:7,代码来源:Station.php

示例10: getLastState

 /**
  * {@inheritdoc}
  */
 public function getLastState()
 {
     return $this->states->last() ?: null;
 }
开发者ID:cleentfaar,项目名称:windmill,代码行数:7,代码来源:Game.php

示例11: last

 /**
  * Sets the internal iterator to the last element in the collection and returns this element.
  *
  * @return mixed
  */
 public function last()
 {
     return $this->collection->last();
 }
开发者ID:Rybbow,项目名称:x-blog,代码行数:9,代码来源:ImmutableCollection.php

示例12: last

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

示例13: testGetIterator

 /**
  * @dataProvider getNodes
  *
  * @param int $total_pages
  * @param string|\Closure $page_link
  * @param string $first_page_link
  * @param ArrayCollection $list
  */
 public function testGetIterator($total_pages, $page_link, $first_page_link, $list)
 {
     $current_page = 1;
     foreach ($list as $node) {
         /** @var $node Node */
         if ($node->isCurrent()) {
             $current_page = $node->getPage();
         }
     }
     $left_offset = $current_page - $list->first()->getPage();
     $right_offset = $list->last()->getPage() - $current_page;
     if ($list->first()->getPage() == 1) {
         $this->config->expects($this->once())->method('getFirstPageLink')->will($this->returnValue($first_page_link));
     } else {
         $this->config->expects($this->never())->method('getFirstPageLink');
     }
     $this->config->expects($this->once())->method('getTotalPages')->will($this->returnValue($total_pages));
     $this->config->expects($this->atLeastOnce())->method('getCurrentPage')->will($this->returnValue($current_page));
     $this->config->expects($this->atLeastOnce())->method('getPageLink')->will($this->returnValue($page_link));
     $this->range->expects($this->once())->method('getLeftOffset')->will($this->returnValue($left_offset));
     $this->range->expects($this->once())->method('getRightOffset')->will($this->returnValue($right_offset));
     $this->assertEquals($list, $this->view->getIterator());
 }
开发者ID:anime-db,项目名称:pagination-bundle,代码行数:31,代码来源:ViewTest.php

示例14: testLast

 /**
  * Tests IdentityWrapper->last()
  */
 public function testLast()
 {
     $expected = end($this->entries);
     $this->assertSame($expected, $this->identityWrapper->last());
     $this->assertSame($expected, $this->wrappedCollection->last());
 }
开发者ID:cross-solution,项目名称:yawik,代码行数:9,代码来源:IdentityWrapperTest.php

示例15: estimateRange

 /**
  * Get estimate points
  *
  * @param EloPlayerInterface $player
  *
  * @return integer
  */
 private function estimateRange(EloPlayerInterface $player)
 {
     $baseRange = new ArrayCollection($this->configuration->getBaseRange());
     $keys = array_keys($this->configuration->getBaseRange());
     $estimatedRange = $baseRange->first();
     $i = 0;
     foreach ($baseRange as $eloMin => $range) {
         if (!isset($keys[$i + 1]) && $player->getElo() > $baseRange->last()) {
             $estimatedRange = $baseRange->last();
             break;
         }
         if ($player->getElo() >= $eloMin && isset($keys[$i + 1]) && $player->getElo() <= $keys[$i + 1]) {
             $estimatedRange = $range;
             break;
         }
         $i++;
     }
     return $estimatedRange;
 }
开发者ID:avoo,项目名称:elo,代码行数:26,代码来源:AbstractElo.php


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