Пример #1
0
 public static function populateObjects(PDOStatement $stmt)
 {
     $results = array();
     $cls = PermisoPeer::getOMClass();
     $cls = substr('.' . $cls, strrpos('.' . $cls, '.') + 1);
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key = PermisoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj = PermisoPeer::getInstanceFromPool($key))) {
             $results[] = $obj;
         } else {
             $obj = new $cls();
             $obj->hydrate($row);
             $results[] = $obj;
             PermisoPeer::addInstanceToPool($obj, $key);
         }
     }
     $stmt->closeCursor();
     return $results;
 }
Пример #2
0
 public static function doSelectJoinAllExceptRol(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     RolPermisoPeer::addSelectColumns($c);
     $startcol2 = RolPermisoPeer::NUM_COLUMNS - RolPermisoPeer::NUM_LAZY_LOAD_COLUMNS;
     PermisoPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + (PermisoPeer::NUM_COLUMNS - PermisoPeer::NUM_LAZY_LOAD_COLUMNS);
     $c->addJoin(array(RolPermisoPeer::FK_PERMISO_ID), array(PermisoPeer::ID), $join_behavior);
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = RolPermisoPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = RolPermisoPeer::getInstanceFromPool($key1))) {
         } else {
             $omClass = RolPermisoPeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             RolPermisoPeer::addInstanceToPool($obj1, $key1);
         }
         $key2 = PermisoPeer::getPrimaryKeyHashFromRow($row, $startcol2);
         if ($key2 !== null) {
             $obj2 = PermisoPeer::getInstanceFromPool($key2);
             if (!$obj2) {
                 $omClass = PermisoPeer::getOMClass();
                 $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
                 $obj2 = new $cls();
                 $obj2->hydrate($row, $startcol2);
                 PermisoPeer::addInstanceToPool($obj2, $key2);
             }
             $obj2->addRolPermiso($obj1);
         }
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
Пример #3
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(PermisoPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
     }
     $con->beginTransaction();
     try {
         $affectedRows = $this->doSave($con);
         $con->commit();
         PermisoPeer::addInstanceToPool($this);
         return $affectedRows;
     } catch (PropelException $e) {
         $con->rollBack();
         throw $e;
     }
 }