/** * @param \BoilerAppAccessControl\Entity\AuthAccessEntity $oAuthAccess * @return \Doctrine\Common\Collections\ArrayCollection */ public function getLatestActivityLogs(\BoilerAppAccessControl\Entity\AuthAccessEntity $oAuthAccess) { $oLatestsActivityLogs = new \Doctrine\Common\Collections\ArrayCollection(); while ($oLatestsActivityLogs->count() < 5) { $oCriteria = new \Doctrine\Common\Collections\Criteria(null, array('entity_create' => 'DESC'), null, 1); $aCriteria = array(); if ($oLatestsActivityLogs->count()) { $oLastLog = $oLatestsActivityLogs->last(); $oCriteria->andWhere(\Doctrine\Common\Collections\Criteria::expr()->neq('log_session_id', $oLastLog->getLogSessionId()))->andWhere(\Doctrine\Common\Collections\Criteria::expr()->lt('entity_create', $oLastLog->getEntityCreate())); } if (!($oLogs = $this->matching($oCriteria)) || !$oLogs->count()) { break; } $oLatestsActivityLogs->add($oLogs->current()); } return $oLatestsActivityLogs; }
/** * get the crawler entry counts * * @return integer */ public function crawlerEntryCount() { $objResult = new \Doctrine\Common\Collections\ArrayCollection($this->findAll()); return $objResult->count(); }
/** * get the all links count * * @param datetime $startTime * @param integer $lang * * @return integer */ public function getLinksCountByLang($startTime, $lang) { $qb = $this->getEntityManager()->createQueryBuilder(); $qb->select('link')->from('Cx\\Core_Modules\\LinkManager\\Model\\Entity\\Link', 'link')->where('link.detectedTime > :start')->andWhere('link.lang = :lang')->orderBy('link.id', 'DESC')->getDql(); $qb->setParameter('start', $startTime)->setParameter('lang', $lang); $objResult = new \Doctrine\Common\Collections\ArrayCollection($qb->getQuery()->getResult()); return $objResult->count(); }