public function systemesAction(Request $request) { $em = $this->getDoctrine()->getManager(); $sysmatricule = $this->get('trc_core.matricule'); $profil = new Systeme(); $formFactory = Forms::createFormFactory(); $form = $this->get('form.factory')->create(new SystemeType(), $profil); if ($form->handleRequest($request)->isValid()) { $profil->setMatricule($sysmatricule->matriculeStandard($profil)); $acteur = new Acteur(); $acteur->setClasse(get_class($profil)); $profil->setActeur($acteur); $em->persist($profil); $em->flush(); return $this->redirect($this->generateUrl('trc_admin_systemes')); } $p = 1; $nbre = 5; $criteres = array(); if ($request->query->get('p') !== null && !empty($request->query->get('p'))) { $p = $request->query->get('p'); } $id = ($p - 1) * $nbre; if ($id < 0) { $id = 0; } $profils = $em->getRepository('TRCCoreBundle:Systeme')->findBy($criteres, array(), $nbre, $id); $servicePagination = $this->get('trc_core.pagination'); $objet = 'Systeme'; $url = $this->generateUrl('trc_admin_profils'); $urlRoute = 'trc_admin_profils'; $pagination = $servicePagination->pagination($objet, $p, $url, $urlRoute, $criteres, $nbre); return $this->render('TRCAdminBundle:Systemes:systemes.html.twig', array('form' => $form->createView(), 'profils' => $profils, 'pagination' => $pagination)); }
private function creerActor($utilisateur) { $entite = new Actor(); $entite->setClasse(get_class($utilisateur)); $this->em->persist($entite); $this->em->flush(); return $entite; }
/** * {@inheritDoc} */ public function getDateajout() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getDateajout', []); return parent::getDateajout(); }