Example #1
0
 /**
  * Gets an array of RelCampoTabla 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 Tabla has previously been saved, it will retrieve
  * related RelCampoTablas from storage. If this Tabla 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 RelCampoTabla[]
  * @throws     PropelException
  */
 public function getRelCampoTablas($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(TablaPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collRelCampoTablas === null) {
         if ($this->isNew()) {
             $this->collRelCampoTablas = array();
         } else {
             $criteria->add(RelCampoTablaPeer::ID_TABLA, $this->id_tabla);
             RelCampoTablaPeer::addSelectColumns($criteria);
             $this->collRelCampoTablas = RelCampoTablaPeer::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(RelCampoTablaPeer::ID_TABLA, $this->id_tabla);
             RelCampoTablaPeer::addSelectColumns($criteria);
             if (!isset($this->lastRelCampoTablaCriteria) || !$this->lastRelCampoTablaCriteria->equals($criteria)) {
                 $this->collRelCampoTablas = RelCampoTablaPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastRelCampoTablaCriteria = $criteria;
     return $this->collRelCampoTablas;
 }
 /**
 * Retrieve object using using composite pkey values.
 * @param      int $id_campo
   @param      int $id_tabla
   
 * @param      PropelPDO $con
 * @return     RelCampoTabla
 */
 public static function retrieveByPK($id_campo, $id_tabla, PropelPDO $con = null)
 {
     $key = serialize(array((string) $id_campo, (string) $id_tabla));
     if (null !== ($obj = RelCampoTablaPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(RelCampoTablaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(RelCampoTablaPeer::DATABASE_NAME);
     $criteria->add(RelCampoTablaPeer::ID_CAMPO, $id_campo);
     $criteria->add(RelCampoTablaPeer::ID_TABLA, $id_tabla);
     $v = RelCampoTablaPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }