/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(PaisesPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(PaisesPeer::DATABASE_NAME); $criteria->add(PaisesPeer::PID, $pks, Criteria::IN); $objs = PaisesPeer::doSelect($criteria, $con); } return $objs; }
<option value="0">... <?php echo __('Seleccione uno'); ?> ...</option><?php $a = new Criteria(); $europeans_pids = array('3', '12', '19', '28', '38', '46', '157', '54', '55', '57', '62', '63', '69', '80', '85', '92', '102', '107', '108', '115', '136', '143', '144', '147', '149', '158', '176'); foreach ($europeans_pids as $pid) { $b = new Criteria(); $b = $a->getNewCriterion(PaisesPeer::PID, $pid); $a->addOr($b); } $paises = PaisesPeer::doSelect($a); foreach ($paises as $pais => $pa) { ?> <option title="<?php echo $pa->getPais(); ?> " value="<?php echo $pa->getPid(); ?> "> <?php echo $pa->getPais(); ?> </option><?php }
<select id="provincia_pais0" name="provincia_0" class="prov list required"><?php include_partial('options_provincias', array('id_provincia' => $notificacion->dec_provincia)); ?> </select><?php } ?> </div> <div id="pais0_div" class="fcell"><?php echo __('País'); ?> <br /><?php if (isset($solicitud) && $solicitud) { if ($notificacion->dec_pais != '') { $c = new Criteria(); $c->add(PaisesPeer::PID, $notificacion->dec_pais); $pais = PaisesPeer::doSelectOne($c); echo input_tag('pais', $pais->getPais()); } else { echo input_tag('pais', ''); } } else { ?> <select id="pais0" name="pais_0" class="pais list required"><?php include_partial('options_paises', array('id_pais' => $notificacion->dec_pais)); ?> </select><?php } ?> </div> </div> <div class="flerro">
/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = PaisesPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setPid($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setPais($arr[$keys[1]]); } }
<option value="0">... <?php echo __('Seleccione uno'); ?> ...</option><?php $paises = PaisesPeer::doSelect(new Criteria()); foreach ($paises as $pais => $pa) { if (isset($id_pais) && $id_pais == $pa->getPid()) { ?> <option title="<?php echo $pa->getPais(); ?> " value="<?php echo $pa->getPid(); ?> " selected="selected"><?php echo $pa->getPais(); ?> </option><?php } else { ?> <option title="<?php echo $pa->getPais(); ?> " value="<?php echo $pa->getPid(); ?> "><?php echo $pa->getPais(); ?> </option><?php }