/** * Exclude object from result * * @param JProfesseursMatieres $jProfesseursMatieres Object to remove from the list of results * * @return JProfesseursMatieresQuery The current query, for fluid interface */ public function prune($jProfesseursMatieres = null) { if ($jProfesseursMatieres) { $this->addCond('pruneCond0', $this->getAliasedColName(JProfesseursMatieresPeer::ID_MATIERE), $jProfesseursMatieres->getIdMatiere(), Criteria::NOT_EQUAL); $this->addCond('pruneCond1', $this->getAliasedColName(JProfesseursMatieresPeer::ID_PROFESSEUR), $jProfesseursMatieres->getIdProfesseur(), Criteria::NOT_EQUAL); $this->combine(array('pruneCond0', 'pruneCond1'), Criteria::LOGICAL_OR); } return $this; }
/** * @param Matiere $matiere The matiere object to add. */ protected function doAddMatiere($matiere) { $jProfesseursMatieres = new JProfesseursMatieres(); $jProfesseursMatieres->setMatiere($matiere); $this->addJProfesseursMatieres($jProfesseursMatieres); }
/** * @param Professeur $professeur The professeur object to add. */ protected function doAddProfesseur($professeur) { $jProfesseursMatieres = new JProfesseursMatieres(); $jProfesseursMatieres->setProfesseur($professeur); $this->addJProfesseursMatieres($jProfesseursMatieres); }
/** * Filter the query by a related JProfesseursMatieres object * * @param JProfesseursMatieres $jProfesseursMatieres the related object to use as filter * @param string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL * * @return MatiereQuery The current query, for fluid interface */ public function filterByJProfesseursMatieres($jProfesseursMatieres, $comparison = null) { if ($jProfesseursMatieres instanceof JProfesseursMatieres) { return $this ->addUsingAlias(MatierePeer::MATIERE, $jProfesseursMatieres->getIdMatiere(), $comparison); } elseif ($jProfesseursMatieres instanceof PropelCollection) { return $this ->useJProfesseursMatieresQuery() ->filterByPrimaryKeys($jProfesseursMatieres->getPrimaryKeys()) ->endUse(); } else { throw new PropelException('filterByJProfesseursMatieres() only accepts arguments of type JProfesseursMatieres or PropelCollection'); } }
} // Maintenant on associe les profs à cette matiere $nb_profs = $matieres[$cpt]['memberuid']['count']; $matiere_profs = $nouvelle_matiere->getProfesseurs(); if ($nb_profs > 0) { for ($i = 0; $i < $nb_profs; $i++) { // On vérifie que le prof existe, quand même... $prof = UtilisateurProfessionnelPeer::retrieveByPK($matieres[$cpt]['memberuid'][$i]); // Le prof existe, on créer l'association, si elle n'existe pas encore if ($prof != null) { // L'association n'existe pas, on la créé // Pour ça, on doit déterminer l'ordre if (!$matiere_profs->contains($prof)) { $assoc = JProfesseursMatieresQuery::create()->filterByProfesseur($prof)->orderByOrdreMatieres('desc')->findOne(); $nouvel_ordre = $assoc == null ? 1 : $assoc->getOrdreMatieres() + 1; $new_assoc = new JProfesseursMatieres(); $new_assoc->setProfesseur($prof); $new_assoc->setMatiere($nouvelle_matiere); $new_assoc->setOrdreMatieres($nouvel_ordre); $new_assoc->save(); } } else { echo "Le prof associé (" . $matieres[$cpt]['memberuid'][$i] . ") n'existe pas dans la base !<br/>"; } } } } // fin parcours des matières /* * Résumé des matières trouvées : */