/** * @param Activity $activity * @return array */ public function findAllSimilar(Activity $activity) { return $this->createQueryBuilder('a')->where('a.id != ?1')->andWhere('a.author = ?2')->andWhere('a.bundleName = ?3')->andWhere('a.bundleOwnerName = ?4')->andWhere('a.message = ?5')->andWhere('a.createdAt = ?6')->setParameter(1, $activity->getId())->setParameter(2, $activity->getAuthor())->setParameter(3, $activity->getBundleName())->setParameter(4, $activity->getBundleOwnerName())->setParameter(5, $activity->getMessage())->setParameter(6, $activity->getCreatedAt())->getQuery()->getResult(); }
/** * @param Activity $activity * * @return boolean */ public function isEqualTo(Activity $activity) { if ($activity->getBundle()->getId() !== $this->bundle->getId()) { return false; } // Compare developers only if actual activity has one if (null !== $this->developer && $activity->getDeveloper()->getId() !== $this->developer->getId()) { return false; } if ($activity->getType() !== $this->type) { return false; } if ($activity->getState() !== $this->state) { return false; } // Compare dates only when state of activity allows it if (self::STATE_FIXED !== $this->state && $activity->getCreatedAt()->getTimestamp() !== $this->createdAt->getTimestamp()) { return false; } return true; }