protected function setFirstAndLastClick(Pap_Common_Transaction $transaction, Pap_Tracking_Common_VisitorAffiliateCollection $collection) { if ($collection->getSize() == 0) { throw new Gpf_Exception('VisitorAffiliates for this visitor are empty'); } $firstVisitorAffiliate = $collection->get(0); $transaction->setFirstClickTime($firstVisitorAffiliate->getDateVisit()); $transaction->setFirstClickReferer($firstVisitorAffiliate->getReferrerUrl()); $transaction->setFirstClickIp($firstVisitorAffiliate->getIp()); $transaction->setFirstClickData1($firstVisitorAffiliate->getData1()); $transaction->setFirstClickData2($firstVisitorAffiliate->getData2()); $lastVisitorAffiliate = $collection->get($collection->getSize()-1); $transaction->setLastClickTime($lastVisitorAffiliate->getDateVisit()); $transaction->setLastClickReferer($lastVisitorAffiliate->getReferrerUrl()); $transaction->setLastClickIp($lastVisitorAffiliate->getIp()); $transaction->setLastClickData1($lastVisitorAffiliate->getData1()); $transaction->setLastClickData2($lastVisitorAffiliate->getData2()); }