Ejemplo n.º 1
0
 /**
  * Creates an Article object based on a DB row.
  *
  * @param array $row The DB row containing Article data.
  * @return \MicroCMS\Domain\Article
  */
 protected function buildDomainObject($row)
 {
     $cotisation = new Cotisation();
     $cotisation->setId($row['cot_id']);
     $cotisation->setDate($row['cot_date']);
     $cotisation->setAdhId($row['cot_adh']);
     $cotisation->setMontant($row['cot_montant']);
     $cotisation->setAuteur($row['int_user_auteur']);
     return $cotisation;
 }
Ejemplo n.º 2
0
                $app['dao.user']->save($user, true);
            }
            $app['session']->getFlashBag()->add('success', 'L\'utilisateur a bien été modifié');
        }
    }
    $userFormView = $userForm->createView();
    return $app['twig']->render('userform.html.twig', array('user' => $user, 'userForm' => $userFormView, 'usernow' => true));
})->bind("myuser-mod");
$app->match('/logged/adm/user-del/{id}', function ($id, Request $request) use($app) {
    $user = $app['dao.user']->find($id);
    $app['dao.user']->del($user);
    return $app->redirect($app["url_generator"]->generate("user-list"));
})->bind("user-del");
$app->match('/logged/cot-add/{idadh}', function ($idadh, Request $request) use($app) {
    $usernow = $app['security']->getToken()->getUser();
    $cotisation = new Cotisation();
    $cotisation->setAdhid($idadh);
    $cotisation->setAuteur($usernow->getId());
    $adherent = $app['dao.adherent']->find($idadh);
    $userFormView = null;
    if ($app['security']->isGranted('IS_AUTHENTICATED_FULLY')) {
        $cotisationForm = $app['form.factory']->create(new CotisationType(), $cotisation);
        $cotisationForm->handleRequest($request);
        if ($cotisationForm->isSubmitted() && $cotisationForm->isValid()) {
            $cotisation->setDate(date("Y-m-d H:i:s"));
            $app['dao.cotisation']->save($cotisation);
            $app['session']->getFlashBag()->add('success', 'Cotisation ajoutée');
        }
        $cotisationFormView = $cotisationForm->createView();
    }
    return $app['twig']->render('cotisationform.html.twig', array('adherent' => $adherent, 'cotisation' => $cotisation, 'cotisationForm' => $cotisationFormView));