Ejemplo n.º 1
0
 /**
  * Gets an array of EtiquetaPolitico 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 sfGuardUser has previously been saved, it will retrieve
  * related EtiquetaPoliticos from storage. If this sfGuardUser 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 EtiquetaPolitico[]
  * @throws     PropelException
  */
 public function getEtiquetaPoliticos($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(sfGuardUserPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collEtiquetaPoliticos === null) {
         if ($this->isNew()) {
             $this->collEtiquetaPoliticos = array();
         } else {
             $criteria->add(EtiquetaPoliticoPeer::SF_GUARD_USER_ID, $this->id);
             EtiquetaPoliticoPeer::addSelectColumns($criteria);
             $this->collEtiquetaPoliticos = EtiquetaPoliticoPeer::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(EtiquetaPoliticoPeer::SF_GUARD_USER_ID, $this->id);
             EtiquetaPoliticoPeer::addSelectColumns($criteria);
             if (!isset($this->lastEtiquetaPoliticoCriteria) || !$this->lastEtiquetaPoliticoCriteria->equals($criteria)) {
                 $this->collEtiquetaPoliticos = EtiquetaPoliticoPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastEtiquetaPoliticoCriteria = $criteria;
     return $this->collEtiquetaPoliticos;
 }
Ejemplo n.º 2
0
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $etiqueta_id
  * @param      int $politico_id
  * @param      string $culture
  * @param      int $sf_guard_user_id
  * @param      PropelPDO $con
  * @return     EtiquetaPolitico
  */
 public static function retrieveByPK($etiqueta_id, $politico_id, $culture, $sf_guard_user_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $etiqueta_id, (string) $politico_id, (string) $culture, (string) $sf_guard_user_id));
     if (null !== ($obj = EtiquetaPoliticoPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(EtiquetaPoliticoPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(EtiquetaPoliticoPeer::DATABASE_NAME);
     $criteria->add(EtiquetaPoliticoPeer::ETIQUETA_ID, $etiqueta_id);
     $criteria->add(EtiquetaPoliticoPeer::POLITICO_ID, $politico_id);
     $criteria->add(EtiquetaPoliticoPeer::CULTURE, $culture);
     $criteria->add(EtiquetaPoliticoPeer::SF_GUARD_USER_ID, $sf_guard_user_id);
     $v = EtiquetaPoliticoPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }