public static function doGuardar($idM, $A_llistes, $idS) { //Seleccionem les actuals del missatge //Reutilitzem les que ja hi ha amb les noves i les que sobren les esborrem. $C = new Criteria(); $C->add(self::IDMISSATGE, $idM); $GUARDATS = array(); foreach (self::doSelect($C) as $OLLM) { if (isset($A_llistes[$OLLM->getIdllista()])) { unset($A_llistes[$OLLM->getIdllista()]); } else { $OLLM->setActiu(false); } } foreach ($A_llistes as $idL => $idL2) { $OLLM = new LlistesLlistesMissatges(); $OLLM->setIdllista($idL); $OLLM->setIdmissatge($idM); $OLLM->setActiu(true); $OLLM->setSiteId($idS); $OLLM->save(); } }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param LlistesLlistesMissatges $value A LlistesLlistesMissatges object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(LlistesLlistesMissatges $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = serialize(array((string) $obj->getIdllista(), (string) $obj->getIdmissatge())); } // if key === null self::$instances[$key] = $obj; } }