Beispiel #1
0
 public function saveUserHasRoleList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['user_has_role_list'])) {
         // somebody has unset this widget
         return;
     }
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(UserHasRolePeer::ROLE_ID, $this->object->getPrimaryKey());
     UserHasRolePeer::doDelete($c, $con);
     $values = $this->getValue('user_has_role_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new UserHasRole();
             $obj->setRoleId($this->object->getPrimaryKey());
             $obj->setUserId($value);
             $obj->save();
         }
     }
 }