Esempio n. 1
0
	/**
	 * Ajoute un eleve au cpe ou au professeur principal
	 * le statut doit etre cpe ou professeur
	 *
	 * @param      Eleve $eleve The JEleveCpe object to relate
	 * @return     void
	 */
	public function addEleve($eleve)
	{
		if ($this->statut != "cpe" && $this->statut != "professeur") {
		    throw new PropelException("le statut de l'utilisateur doit etre cpe ou professeur");
		}
		if ($this->collEleves === null) {
		    $this->initEleves();
		}

		if (!$this->collEleves->contains($eleve)) { // only add it if the **same** object is not already associated
		    if ($this->statut == "cpe") {
			$jEleveCpe = new JEleveCpe();
			$jEleveCpe->setEleve($eleve);
			$this->addJEleveCpe($jEleveCpe);

			$this->collEleves[]= $eleve;
		    } else if ($this->statut == "professeur") {
			$jEleveProfesseurPrincipal = new JEleveProfesseurPrincipal();
			$jEleveProfesseurPrincipal->setEleve($eleve);
			$this->addJEleveProfesseurPrincipal($jEleveProfesseurPrincipal);

			$this->collEleves[]= $eleve;

		    }
		}
	}
Esempio n. 2
0
	/**
	 * @param	JEleveProfesseurPrincipal $jEleveProfesseurPrincipal The jEleveProfesseurPrincipal object to add.
	 */
	protected function doAddJEleveProfesseurPrincipal($jEleveProfesseurPrincipal)
	{
		$this->collJEleveProfesseurPrincipals[]= $jEleveProfesseurPrincipal;
		$jEleveProfesseurPrincipal->setEleve($this);
	}
	/**
	 * Filter the query by a related JEleveProfesseurPrincipal object
	 *
	 * @param     JEleveProfesseurPrincipal $jEleveProfesseurPrincipal  the related object to use as filter
	 * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
	 *
	 * @return    UtilisateurProfessionnelQuery The current query, for fluid interface
	 */
	public function filterByJEleveProfesseurPrincipal($jEleveProfesseurPrincipal, $comparison = null)
	{
		if ($jEleveProfesseurPrincipal instanceof JEleveProfesseurPrincipal) {
			return $this
				->addUsingAlias(UtilisateurProfessionnelPeer::LOGIN, $jEleveProfesseurPrincipal->getProfesseur(), $comparison);
		} elseif ($jEleveProfesseurPrincipal instanceof PropelCollection) {
			return $this
				->useJEleveProfesseurPrincipalQuery()
				->filterByPrimaryKeys($jEleveProfesseurPrincipal->getPrimaryKeys())
				->endUse();
		} else {
			throw new PropelException('filterByJEleveProfesseurPrincipal() only accepts arguments of type JEleveProfesseurPrincipal or PropelCollection');
		}
	}