Exemple #1
0
 /**
  * Sign up  an activity.
  *
  * @param ActivityModel $activity
  */
 public function signUp(ActivityModel $activity)
 {
     $em = $this->getServiceManager()->get('Doctrine\\ORM\\EntityManager');
     // Find the current user
     $user = $this->getServiceManager()->get('user_role');
     if ($user === 'guest') {
         throw new \InvalidArgumentException('Guests can not create activities');
     }
     $user = $em->merge($user);
     $signup = new ActivitySignup();
     $signup->setActivity($activity);
     $signup->setUser($user);
     $em->persist($signup);
     $em->flush();
 }
 /**
  * Finds all field values associated with the $signup
  * 
  * @param \Activity\Model\ActivitySignup $signup
  * @return array of \Activity\Model\ActivityFieldValue
  */
 public function getFieldValuesBySignup(\Activity\Model\ActivitySignup $signup)
 {
     return $this->getRepository()->findBy(array('signup' => $signup->getId()));
 }