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();
         }
     }
 }
Ejemplo 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;
 }
Ejemplo n.º 3
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = AppDocumentsPermisosPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdusuari($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdarxiu($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setIdnivell($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDatamodificacio($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setSiteId($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setActiu($arr[$keys[5]]);
     }
 }
Ejemplo n.º 4
0
 /**
  * Method to invalidate the instance pool of all tables related to nivells
  * by a foreign key with ON DELETE CASCADE
  */
 public static function clearRelatedInstancePool()
 {
     // invalidate objects in AppDocumentsPermisosPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule.
     AppDocumentsPermisosPeer::clearInstancePool();
     // invalidate objects in AppDocumentsPermisosDirPeer instance pool, since one or more of them may be deleted by ON DELETE CASCADE rule.
     AppDocumentsPermisosDirPeer::clearInstancePool();
 }
Ejemplo n.º 5
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Nivells is new, it will return
  * an empty collection; or if this Nivells has previously
  * been saved, it will retrieve related AppDocumentsPermisoss from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Nivells.
  */
 public function getAppDocumentsPermisossJoinAppDocumentsArxius($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(NivellsPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collAppDocumentsPermisoss === null) {
         if ($this->isNew()) {
             $this->collAppDocumentsPermisoss = array();
         } else {
             $criteria->add(AppDocumentsPermisosPeer::IDNIVELL, $this->idnivells);
             $this->collAppDocumentsPermisoss = AppDocumentsPermisosPeer::doSelectJoinAppDocumentsArxius($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(AppDocumentsPermisosPeer::IDNIVELL, $this->idnivells);
         if (!isset($this->lastAppDocumentsPermisosCriteria) || !$this->lastAppDocumentsPermisosCriteria->equals($criteria)) {
             $this->collAppDocumentsPermisoss = AppDocumentsPermisosPeer::doSelectJoinAppDocumentsArxius($criteria, $con, $join_behavior);
         }
     }
     $this->lastAppDocumentsPermisosCriteria = $criteria;
     return $this->collAppDocumentsPermisoss;
 }
Ejemplo n.º 6
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;
 }
Ejemplo n.º 7
0
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $idusuari
  * @param      int $idarxiu
  * @param      PropelPDO $con
  * @return     AppDocumentsPermisos
  */
 public static function retrieveByPK($idusuari, $idarxiu, PropelPDO $con = null)
 {
     $key = serialize(array((string) $idusuari, (string) $idarxiu));
     if (null !== ($obj = AppDocumentsPermisosPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(AppDocumentsPermisosPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(AppDocumentsPermisosPeer::DATABASE_NAME);
     $criteria->add(AppDocumentsPermisosPeer::IDUSUARI, $idusuari);
     $criteria->add(AppDocumentsPermisosPeer::IDARXIU, $idarxiu);
     $v = AppDocumentsPermisosPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }