Exemple #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();
         }
     }
 }