Beispiel #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)
 {
     $adherent = new Adherent();
     $adherent->setId($row['adh_id']);
     $adherent->setCivilite($row['adh_civilite']);
     $adherent->setNom($row['adh_nom']);
     $adherent->setPrenom($row['adh_prenom']);
     $adherent->setGroupe($row['adh_groupe']);
     $adherent->setAdresse($row['adh_adresse']);
     $adherent->setCodePostal($row['adh_codepostal']);
     $adherent->setVille($row['adh_ville']);
     $adherent->setDepartement($row['adh_departement']);
     $adherent->setPays($row['adh_pays']);
     $adherent->setEmail($row['adh_email']);
     $adherent->setPhone($row['adh_phone']);
     $adherent->setMobile($row['adh_mobile']);
     $adherent->setDateCreation($row['adh_datecreation']);
     $adherent->setUserAuteur($row['int_user_auteur']);
     $adherent->setDateLastMod($row['adh_datelastmod']);
     $adherent->setUserLastModAuteur($row['int_user_lastmodauteur']);
     $adherent->setIsajour($row['adh_isajour']);
     return $adherent;
 }
Beispiel #2
0
    $groupes = $app['dao.groupe']->findAll();
    $usernow = $app['security']->getToken()->getUser();
    $adherentFormView = null;
    if ($app['security']->isGranted('IS_AUTHENTICATED_FULLY')) {
        $adherentForm = $app['form.factory']->create(new AdherentType($groupes), $adherent);
        $adherentForm->handleRequest($request);
        if ($adherentForm->isSubmitted() && $adherentForm->isValid()) {
            $app['dao.adherent']->save($adherent, $usernow);
            $app['session']->getFlashBag()->add('success', 'L\'utilisateur a bien été modifié');
        }
        $adherentFormView = $adherentForm->createView();
    }
    return $app['twig']->render('adherentform.html.twig', array('adherent' => $adherent, 'users' => $users, 'groupes' => $groupes, 'adherentForm' => $adherentFormView));
})->bind("adherentmod");
$app->match('/logged/adherent-add/', function (Request $request) use($app) {
    $adherent = new Adherent();
    $adherent->setIsajour(false);
    $users = $app['dao.user']->findAll();
    $groupes = $app['dao.groupe']->findAll();
    $usernow = $app['security']->getToken()->getUser();
    $adherentFormView = null;
    if ($app['security']->isGranted('IS_AUTHENTICATED_FULLY')) {
        $adherentForm = $app['form.factory']->create(new AdherentType($groupes), $adherent);
        $adherentForm->handleRequest($request);
        if ($adherentForm->isSubmitted() && $adherentForm->isValid()) {
            $app['dao.adherent']->save($adherent, $usernow);
            $app['session']->getFlashBag()->add('success', 'L\'utilisateur a bien été ajouté');
            return $app->redirect($app["url_generator"]->generate("adherent", array('id' => $adherent->getId())));
        } else {
            $adherentFormView = $adherentForm->createView();
            return $app['twig']->render('adherentform.html.twig', array('adherent' => $adherent, 'users' => $users, 'groupes' => $groupes, 'adherentForm' => $adherentFormView));