Esempio n. 1
0
 public function save(PropelPDO $con = null)
 {
     if ($this->isDeleted()) {
         throw new PropelException("You cannot save an object that has been deleted.");
     }
     if ($con === null) {
         $con = Propel::getConnection(UsuarioPermisoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $affectedRows = $this->doSave($con);
         $con->commit();
         UsuarioPermisoPeer::addInstanceToPool($this);
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }
Esempio n. 2
0
 public static function doSelectJoinAllExceptPermiso(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     UsuarioPermisoPeer::addSelectColumns($c);
     $startcol2 = UsuarioPermisoPeer::NUM_COLUMNS - UsuarioPermisoPeer::NUM_LAZY_LOAD_COLUMNS;
     UsuarioPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (UsuarioPeer::NUM_COLUMNS - UsuarioPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(UsuarioPermisoPeer::FK_USUARIO_ID), array(UsuarioPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = UsuarioPermisoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = UsuarioPermisoPeer::getInstanceFromPool($key1))) {
         } else {
             $omClass = UsuarioPermisoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             UsuarioPermisoPeer::addInstanceToPool($obj1, $key1);
         }
         $key2 = UsuarioPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = UsuarioPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = UsuarioPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 UsuarioPeer::addInstanceToPool($obj2, $key2);
             }
             $obj2->addUsuarioPermiso($obj1);
         }
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }