/**
  * Returns a new AmistadQuery object.
  *
  * @param     string $modelAlias The alias of a model in the query
  * @param     Criteria $criteria Optional Criteria to build the query from
  *
  * @return    AmistadQuery
  */
 public static function create($modelAlias = null, $criteria = null)
 {
     if ($criteria instanceof AmistadQuery) {
         return $criteria;
     }
     $query = new AmistadQuery();
     if (null !== $modelAlias) {
         $query->setModelAlias($modelAlias);
     }
     if ($criteria instanceof Criteria) {
         $query->mergeWith($criteria);
     }
     return $query;
 }
Esempio n. 2
0
 /**
  * Returns the number of related Amistad objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      PropelPDO $con
  * @return     int Count of related Amistad objects.
  * @throws     PropelException
  */
 public function countAmistadsRelatedByid_usuarioamigo(Criteria $criteria = null, $distinct = false, PropelPDO $con = null)
 {
     if (null === $this->collAmistadsRelatedByid_usuarioamigo || null !== $criteria) {
         if ($this->isNew() && null === $this->collAmistadsRelatedByid_usuarioamigo) {
             return 0;
         } else {
             $query = AmistadQuery::create(null, $criteria);
             if ($distinct) {
                 $query->distinct();
             }
             return $query->filterByUsuarioRelatedByid_usuarioamigo($this)->count($con);
         }
     } else {
         return count($this->collAmistadsRelatedByid_usuarioamigo);
     }
 }
Esempio n. 3
0
<?php 
//@session_star();
error_reporting(E_ALL);
ini_set("display_errors", 1);
include_once "../../data/config.php";
if (isset($_GET["id"]) == "") {
    include 'solicitud.php';
    //die();
} else {
    $amistad = AmistadQuery::create()->filterById_usuario($_SESSION['userid'])->filterByid_usuarioamigo($_GET['id'])->find();
    if ($amistad == null) {
        include 'solicitud.php';
    }
}
?>

Esempio n. 4
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      PropelPDO $con
  * @return     void
  * @throws     PropelException
  * @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(AmistadPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $deleteQuery = AmistadQuery::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;
     }
 }