/** * Count a hit for the specified photo. Should be called whenever a photo is viewed. * * @param \Photo\Model\Photo $photo */ public function countHit($photo) { $hit = new HitModel(); $hit->setDateTime(new \DateTime()); $photo->addHit($hit); $this->getPhotoMapper()->flush(); }