示例#1
0
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $partido_id
  * @param      int $lista_id
  * @param      PropelPDO $con
  * @return     PartidoLista
  */
 public static function retrieveByPK($partido_id, $lista_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $partido_id, (string) $lista_id));
     if (null !== ($obj = PartidoListaPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(PartidoListaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(PartidoListaPeer::DATABASE_NAME);
     $criteria->add(PartidoListaPeer::PARTIDO_ID, $partido_id);
     $criteria->add(PartidoListaPeer::LISTA_ID, $lista_id);
     $v = PartidoListaPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }
示例#2
0
 /**
  * Gets an array of PartidoLista objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Partido has previously been saved, it will retrieve
  * related PartidoListas from storage. If this Partido is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array PartidoLista[]
  * @throws     PropelException
  */
 public function getPartidoListas($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(PartidoPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPartidoListas === null) {
         if ($this->isNew()) {
             $this->collPartidoListas = array();
         } else {
             $criteria->add(PartidoListaPeer::PARTIDO_ID, $this->id);
             PartidoListaPeer::addSelectColumns($criteria);
             $this->collPartidoListas = PartidoListaPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // the following code is to determine if a new query is
             // called for.  If the criteria is the same as the last
             // one, just return the collection.
             $criteria->add(PartidoListaPeer::PARTIDO_ID, $this->id);
             PartidoListaPeer::addSelectColumns($criteria);
             if (!isset($this->lastPartidoListaCriteria) || !$this->lastPartidoListaCriteria->equals($criteria)) {
                 $this->collPartidoListas = PartidoListaPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPartidoListaCriteria = $criteria;
     return $this->collPartidoListas;
 }