public function saveAppDocumentsPermisosList($con = null)
 {
     if (!$this->isValid()) {
         throw $this->getErrorSchema();
     }
     if (!isset($this->widgetSchema['app_documents_permisos_list'])) {
         // somebody has unset this widget
         return;
     }
     if (null === $con) {
         $con = $this->getConnection();
     }
     $c = new Criteria();
     $c->add(AppDocumentsPermisosPeer::IDARXIU, $this->object->getPrimaryKey());
     AppDocumentsPermisosPeer::doDelete($c, $con);
     $values = $this->getValue('app_documents_permisos_list');
     if (is_array($values)) {
         foreach ($values as $value) {
             $obj = new AppDocumentsPermisos();
             $obj->setIdarxiu($this->object->getPrimaryKey());
             $obj->setIdusuari($value);
             $obj->save();
         }
     }
 }
Exemplo n.º 2
0
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = UsuarisPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related AppDocumentsPermisos objects
         $criteria = new Criteria(AppDocumentsPermisosPeer::DATABASE_NAME);
         $criteria->add(AppDocumentsPermisosPeer::IDUSUARI, $obj->getUsuariid());
         $affectedRows += AppDocumentsPermisosPeer::doDelete($criteria, $con);
         // delete related AppDocumentsPermisosDir objects
         $criteria = new Criteria(AppDocumentsPermisosDirPeer::DATABASE_NAME);
         $criteria->add(AppDocumentsPermisosDirPeer::IDUSUARI, $obj->getUsuariid());
         $affectedRows += AppDocumentsPermisosDirPeer::doDelete($criteria, $con);
         // delete related Cessio objects
         $criteria = new Criteria(CessioPeer::DATABASE_NAME);
         $criteria->add(CessioPeer::USUARI_ID, $obj->getUsuariid());
         $affectedRows += CessioPeer::doDelete($criteria, $con);
         // delete related Factures objects
         $criteria = new Criteria(FacturesPeer::DATABASE_NAME);
         $criteria->add(FacturesPeer::VALIDAUSUARI, $obj->getUsuariid());
         $affectedRows += FacturesPeer::doDelete($criteria, $con);
         // delete related Matricules objects
         $criteria = new Criteria(MatriculesPeer::DATABASE_NAME);
         $criteria->add(MatriculesPeer::USUARIS_USUARIID, $obj->getUsuariid());
         $affectedRows += MatriculesPeer::doDelete($criteria, $con);
         // delete related Missatges objects
         $criteria = new Criteria(MissatgesPeer::DATABASE_NAME);
         $criteria->add(MissatgesPeer::USUARIS_USUARIID, $obj->getUsuariid());
         $affectedRows += MissatgesPeer::doDelete($criteria, $con);
         // delete related Personal objects
         $criteria = new Criteria(PersonalPeer::DATABASE_NAME);
         $criteria->add(PersonalPeer::IDUSUARI, $obj->getUsuariid());
         $affectedRows += PersonalPeer::doDelete($criteria, $con);
         // delete related Reservaespais objects
         $criteria = new Criteria(ReservaespaisPeer::DATABASE_NAME);
         $criteria->add(ReservaespaisPeer::USUARIS_USUARIID, $obj->getUsuariid());
         $affectedRows += ReservaespaisPeer::doDelete($criteria, $con);
         // delete related UsuarisApps objects
         $criteria = new Criteria(UsuarisAppsPeer::DATABASE_NAME);
         $criteria->add(UsuarisAppsPeer::USUARI_ID, $obj->getUsuariid());
         $affectedRows += UsuarisAppsPeer::doDelete($criteria, $con);
         // delete related UsuarisMenus objects
         $criteria = new Criteria(UsuarisMenusPeer::DATABASE_NAME);
         $criteria->add(UsuarisMenusPeer::USUARI_ID, $obj->getUsuariid());
         $affectedRows += UsuarisMenusPeer::doDelete($criteria, $con);
         // delete related UsuarisSites objects
         $criteria = new Criteria(UsuarisSitesPeer::DATABASE_NAME);
         $criteria->add(UsuarisSitesPeer::USUARI_ID, $obj->getUsuariid());
         $affectedRows += UsuarisSitesPeer::doDelete($criteria, $con);
         // delete related Usuarisllistes objects
         $criteria = new Criteria(UsuarisllistesPeer::DATABASE_NAME);
         $criteria->add(UsuarisllistesPeer::USUARIS_USUARISID, $obj->getUsuariid());
         $affectedRows += UsuarisllistesPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
Exemplo n.º 3
0
 /**
  * Removes this object from datastore and sets delete attribute.
  *
  * @param      PropelPDO $con
  * @return     void
  * @throws     PropelException
  * @see        BaseObject::setDeleted()
  * @see        BaseObject::isDeleted()
  */
 public function delete(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("This object has already been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(AppDocumentsPermisosPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $ret = $this->preDelete($con);
         // symfony_behaviors behavior
         foreach (sfMixer::getCallables('BaseAppDocumentsPermisos:delete:pre') as $callable) {
             if (call_user_func($callable, $this, $con)) {
                 $con->commit();
                 return;
             }
         }
         if ($ret) {
             AppDocumentsPermisosPeer::doDelete($this, $con);
             $this->postDelete($con);
             // symfony_behaviors behavior
             foreach (sfMixer::getCallables('BaseAppDocumentsPermisos:delete:post') as $callable) {
                 call_user_func($callable, $this, $con);
             }
             $this->setDeleted(true);
             $con->commit();
         } else {
             $con->commit();
         }
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
Exemplo n.º 4
0
 /**
  * This is a method for emulating ON DELETE CASCADE for DBs that don't support this
  * feature (like MySQL or SQLite).
  *
  * This method is not very speedy because it must perform a query first to get
  * the implicated records and then perform the deletes by calling those Peer classes.
  *
  * This method should be used within a transaction if possible.
  *
  * @param      Criteria $criteria
  * @param      PropelPDO $con
  * @return     int The number of affected rows (if supported by underlying database driver).
  */
 protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
 {
     // initialize var to track total num of affected rows
     $affectedRows = 0;
     // first find the objects that are implicated by the $criteria
     $objects = AppDocumentsArxiusPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related AppDocumentsPermisos objects
         $criteria = new Criteria(AppDocumentsPermisosPeer::DATABASE_NAME);
         $criteria->add(AppDocumentsPermisosPeer::IDARXIU, $obj->getIddocument());
         $affectedRows += AppDocumentsPermisosPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }