Exemplo n.º 1
0
 public function saveUsuarisSitesList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['usuaris_sites_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(UsuarisSitesPeer::SITE_ID, $this->object->getPrimaryKey());
     UsuarisSitesPeer::doDelete($c, $con);
     $values = $this->getValue('usuaris_sites_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new UsuarisSites();
             $obj->setSiteId($this->object->getPrimaryKey());
             $obj->setUsuariId($value);
             $obj->save();
         }
     }
 }
Exemplo n.º 2
0
 /**
  * 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      UsuarisSites $value A UsuarisSites object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool(UsuarisSites $obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = serialize(array((string) $obj->getUsuariId(), (string) $obj->getSiteId()));
         }
         // if key === null
         self::$instances[$key] = $obj;
     }
 }
Exemplo n.º 3
0
 /**
  * Inicialitzem un formulari de UsuariSite      
  * @param $idU Usuari ID
  * @param $idS Site ID
  * @param $new Es mostra "Mostra l'opció NEW SITE al formulari"
  * @return UsuarisSitesForm()
  * */
 public static function initialize($idU, $idS, $new = false)
 {
     $OO = UsuarisSitesPeer::retrieveByPK($idU, $idS);
     if (!$OO instanceof UsuarisSites) {
         $OO = new UsuarisSites();
         $OO->setUsuariId($idU);
         $OO->setSiteId($idS);
         $OO->setNivellId(NivellsPeer::REGISTRAT);
         $OO->setActiu(true);
     }
     return new UsuarisSitesForm($OO, array('IDS' => $idS, 'NEW' => $new));
 }