Beispiel #1
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param PropelPDO $con
  * @return void
  * @throws PropelException
  * @throws Exception
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(PersonnePeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = PersonneQuery::create()->filterByPrimaryKey($this->getPrimaryKey());
         $ret = $this->preDelete($con);
         if ($ret) {
             $deleteQuery->delete($con);
             $this->postDelete($con);
             $con->commit();
             $this->setDeleted(true);
         } else {
             $con->commit();
         }
     } catch (Exception $e) {
         $con->rollBack();
         throw $e;
     }
 }
Beispiel #2
0
 /**
  * Get the associated Personne object
  *
  * @param PropelPDO $con Optional Connection object.
  * @return Personne The associated Personne object.
  * @throws PropelException
  */
 public function getPersonne(PropelPDO $con = null)
 {
     if ($this->aPersonne === null && $this->personne_id !== null) {
         $this->aPersonne = PersonneQuery::create()->findPk($this->personne_id, $con);
         /* The following can be used additionally to
               guarantee the related object contains a reference
               to this object.  This level of coupling may, however, be
               undesirable since it could result in an only partially populated collection
               in the referenced object.
               $this->aPersonne->addCotisations($this);
            */
     }
     return $this->aPersonne;
 }
Beispiel #3
0
 /**
  * Returns a new PersonneQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     PersonneQuery|Criteria $criteria Optional Criteria to build the query from
  *
  * @return PersonneQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof PersonneQuery) {
         return $criteria;
     }
     $query = new PersonneQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
Beispiel #4
0
 public function setPersonne($login, $prenom, $nom, $mail, $is_adulte)
 {
     // check les droits
     if (!$this->auth->getDroitEcriture()) {
         throw new ApiException(403);
     }
     // récupération de la personne concernée
     $personne = PersonneQuery::create()->findOneByLogin($login);
     if (!$personne) {
         throw new ApiException(404);
     }
     $personne->updateFromUser($prenom, $nom, $mail, $is_adulte);
     return $personne->getArray($this->auth->getDroitBadges());
 }