/**
  * Esta funcion permite cancelar invitaciones pendientes de un usuario
  * para que no queden varias invitaciones pendientes repetidas
  * @author Cesar Giraldo <*****@*****.**> 20/01/2016
  * @param Entity\User $user
  * @param Entity\Project $project
  */
 private function cancelPendingInvitations($user, $project)
 {
     $em = $this->getDoctrine()->getManager();
     $search = array('user' => $user->getId(), 'project' => $project->getId());
     $invitations = $em->getRepository('BackendBundle:ProjectInvitation')->findBy($search);
     foreach ($invitations as $invitation) {
         $invitation->setStatus(Entity\ProjectInvitation::STATUS_CANCELED);
         $invitation->setCanceledDate(Util::getCurrentDate());
         $em->persist($invitation);
     }
     $em->flush();
 }
 /**
  * Creates a form to delete a Project entity.
  * @author Cesar Giraldo <*****@*****.**> 12/01/2016
  * @param Entity\Project $project The Project entity
  * @return \Symfony\Component\Form\Form The form
  */
 private function createDeleteForm(Entity\Project $project)
 {
     return $this->createFormBuilder()->setAction($this->generateUrl('backend_projects_delete', array('id' => $project->getId())))->setMethod('DELETE')->getForm();
 }