/**
  * Get the associated Factures object
  *
  * @param      PropelPDO Optional Connection object.
  * @return     Factures The associated Factures object.
  * @throws     PropelException
  */
 public function getFactures(PropelPDO $con = null)
 {
     if ($this->aFactures === null && $this->factures_facturaid !== null) {
         $this->aFactures = FacturesPeer::retrieveByPk($this->factures_facturaid);
         /* The following can be used additionally to
         		   guarantee the related object contains a reference
         		   to this object.  This level of coupling may, however, be
         		   undesirable since it could result in an only partially populated collection
         		   in the referenced object.
         		   $this->aFactures->addEquipaments($this);
         		 */
     }
     return $this->aFactures;
 }
Exemple #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;
 }
Exemple #3
0
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Conceptes is new, it will return
  * an empty collection; or if this Conceptes has previously
  * been saved, it will retrieve related Facturess 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 Conceptes.
  */
 public function getFacturessJoinUsuaris($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(ConceptesPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collFacturess === null) {
         if ($this->isNew()) {
             $this->collFacturess = array();
         } else {
             $criteria->add(FacturesPeer::CONCEPTES_CONCEPTEID, $this->concepteid);
             $this->collFacturess = FacturesPeer::doSelectJoinUsuaris($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(FacturesPeer::CONCEPTES_CONCEPTEID, $this->concepteid);
         if (!isset($this->lastFacturesCriteria) || !$this->lastFacturesCriteria->equals($criteria)) {
             $this->collFacturess = FacturesPeer::doSelectJoinUsuaris($criteria, $con, $join_behavior);
         }
     }
     $this->lastFacturesCriteria = $criteria;
     return $this->collFacturess;
 }
Exemple #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 = ProveidorsPeer::doSelect($criteria, $con);
     foreach ($objects as $obj) {
         // delete related Factures objects
         $criteria = new Criteria(FacturesPeer::DATABASE_NAME);
         $criteria->add(FacturesPeer::PROVEIDORS_PROVEIDORID, $obj->getProveidorid());
         $affectedRows += FacturesPeer::doDelete($criteria, $con);
     }
     return $affectedRows;
 }
Exemple #5
0
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(FacturesPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(FacturesPeer::DATABASE_NAME);
         $criteria->add(FacturesPeer::FACTURAID, $pks, Criteria::IN);
         $objs = FacturesPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * 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 = FacturesPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setFacturaid($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setProveidorsProveidorid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setConceptesConcepteid($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setDatafactura($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setQuantitat($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setNumfactura($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setDatapagament($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setModalitatpagament($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setSubconcepte($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setTipuscomptable($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setText($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setValidausuari($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setValidatdata($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setSiteId($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setActiu($arr[$keys[14]]);
     }
 }
Exemple #7
0
 /**
  * Selects a collection of Equipament objects pre-filled with all related objects.
  *
  * @param      Criteria  $criteria
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Equipament objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     EquipamentPeer::addSelectColumns($criteria);
     $startcol2 = EquipamentPeer::NUM_COLUMNS - EquipamentPeer::NUM_LAZY_LOAD_COLUMNS;
     FacturesPeer::addSelectColumns($criteria);
     $startcol3 = $startcol2 + (FacturesPeer::NUM_COLUMNS - FacturesPeer::NUM_LAZY_LOAD_COLUMNS);
     $criteria->addJoin(EquipamentPeer::FACTURES_FACTURAID, FacturesPeer::FACTURAID, $join_behavior);
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
         call_user_func($sf_hook, 'BaseEquipamentPeer', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = EquipamentPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = EquipamentPeer::getInstanceFromPool($key1))) {
             // We no longer rehydrate the object, since this can cause data loss.
             // See http://propel.phpdb.org/trac/ticket/509
             // $obj1->hydrate($row, 0, true); // rehydrate
         } else {
             $cls = EquipamentPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             EquipamentPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         // Add objects for joined Factures rows
         $key2 = FacturesPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = FacturesPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $cls = FacturesPeer::getOMClass(false);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 FacturesPeer::addInstanceToPool($obj2, $key2);
             }
             // if obj2 loaded
             // Add the $obj1 (Equipament) to the collection in $obj2 (Factures)
             $obj2->addEquipament($obj1);
         }
         // if joined row not null
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }