/**
  * Sauvegarde ou met a jour le personnage et le raid passé.
  * @param \Commun\Model\Personnages $oPersonnage
  * @param \Commun\Model\Raids $oRaids
  * @return  \Core\Model\RaidPersonnage
  */
 public function saveOrUpdateRaid($oPersonnage, $oRaids)
 {
     try {
         //recherche si le raid existe
         /* @var $oTab \Commun\Model\Raids */
         $oTab = $this->selectBy(array("idPersonnage" => $oPersonnage->getIdPersonnage(), "idRaid" => $oRaids->getIdRaid()));
         $oRaidPersonnage = new \Commun\Model\RaidPersonnage();
         // coder au cas ou on rajoute d'autre info dans la table
         // si n'existe pas on insert
         if (!$oTab) {
             $oRaidPersonnage->setIdPersonnage($oPersonnage->getIdPersonnage());
             $oRaidPersonnage->setIdRaid($oRaids->getIdRaid());
             $this->insert($oRaidPersonnage);
             return $oRaidPersonnage;
         }
         // ne fonctionne pas car mon abstractTable ne gère pas les multi clé
         //        else {
         //            // sinon on update
         //            $oTab->setIdPersonnage($oPersonnage->getIdPersonnage());
         //            $oTab->setIdRaid($oRaids->getIdRaid());
         //            $this->update($oTab);
         //        }
         return $oTab;
     } catch (Exception $exc) {
         throw new \Exception("Erreur lors de la sauvegarde /maj du lien raid/personnage", 0, $ex);
     }
 }
 /**
  * Action pour la création.
  *
  * @return array
  */
 public function createAction()
 {
     $oForm = new \Commun\Form\RaidPersonnageForm();
     //new \Commun\Form\RaidPersonnageForm($this->getServiceLocator());
     $oRequest = $this->getRequest();
     $oFiltre = new \Commun\Filter\RaidPersonnageFilter();
     $oForm->setInputFilter($oFiltre->getInputFilter());
     if ($oRequest->isPost()) {
         $oEntite = new \Commun\Model\RaidPersonnage();
         $oForm->setData($oRequest->getPost());
         if ($oForm->isValid()) {
             $oEntite->exchangeArray($oForm->getData());
             $this->getTable()->insert($oEntite);
             $this->flashMessenger()->addMessage($this->_getServTranslator()->translate("La raid-personnage a été créé avec succès."), 'success');
             return $this->redirect()->toRoute('backend-raid-personnage-list');
         }
     }
     // Pour optimiser le rendu
     $oViewModel = new ViewModel();
     $oViewModel->setTemplate('backend/raid-personnage/create');
     return $oViewModel->setVariables(array('form' => $oForm));
 }