public function published_and_geocoded_by_state($state) { $crit = new Criteria(); $crit->add(GroupPeer::LAT, null, Criteria::NOT_EQUAL); $crit->add(GroupPeer::PUBLISH, true); $crit->add(GroupPeer::STATE, $state); return GroupPeer::doSelect($crit); }
/** * 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(GroupPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(GroupPeer::DATABASE_NAME); $criteria->add(GroupPeer::ID, $pks, Criteria::IN); $objs = GroupPeer::doSelect($criteria, $con); } return $objs; }
<?php require_once 'start.php'; // initialize DIA library require_once APP_ROOT . '/lib/democracyinaction-php/api.php'; $dia_config = $app_config['democracy_in_action']; $dia = new DemocracyInAction_API($dia_config['node'], $dia_config['login'], $dia_config['password']); $dia->authenticate(); $dia_groups = $dia->get(Group::dia_object); if (!$dia_groups) { print "auth failed"; exit; } foreach ($dia_groups as $dia_group) { $group = GroupPeer::find_or_create_by_dia_key($dia_group); $group->save(); } $groups = GroupPeer::doSelect(new Criteria()); $groups_to_geocode = GroupPeer::geocodable(); foreach ($groups_to_geocode as $group) { $group->geocode(); $group->save(); }