Esempio n. 1
0
 /**
  * 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();
 }
Esempio n. 2
0
 /**
  * Add a hit to a photo
  *
  * @param \Photo\Model\Hit $hit
  */
 public function addHit($hit)
 {
     $hit->setPhoto($this);
     $this->hits[] = $hit;
 }