Exemplo n.º 1
0
 /**
  * Populates an object of the default type or an object that inherit from the default.
  *
  * @param      array $row PropelPDO resultset row.
  * @param      int $startcol The 0-based offset for reading from the resultset row.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  * @return     array (Message object, last column rank)
  */
 public static function populateObject($row, $startcol = 0)
 {
     $key = MessagePeer::getPrimaryKeyHashFromRow($row, $startcol);
     if (null !== ($obj = MessagePeer::getInstanceFromPool($key))) {
         // We no longer rehydrate the object, since this can cause data loss.
         // See http://www.propelorm.org/ticket/509
         // $obj->hydrate($row, $startcol, true); // rehydrate
         $col = $startcol + MessagePeer::NUM_COLUMNS;
     } else {
         $cls = MessagePeer::OM_CLASS;
         $obj = new $cls();
         $col = $obj->hydrate($row, $startcol);
         MessagePeer::addInstanceToPool($obj, $key);
     }
     return array($obj, $col);
 }
Exemplo n.º 2
0
 /**
  * Selects a collection of Message objects pre-filled with all related objects except UserRelatedByOwnerId.
  *
  * @param      Criteria  $c
  * @param      PropelPDO $con
  * @param      String    $join_behavior the type of joins to use, defaults to Criteria::LEFT_JOIN
  * @return     array Array of Message objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUserRelatedByOwnerId(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     // $c->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     MessagePeer::addSelectColumns($c);
     $startcol2 = MessagePeer::NUM_COLUMNS - MessagePeer::NUM_LAZY_LOAD_COLUMNS;
     $stmt = BasePeer::doSelect($c, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = MessagePeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = MessagePeer::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 {
             $omClass = MessagePeer::getOMClass();
             $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             MessagePeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }