public static function doSelectJoinAllExceptWorktype(Criteria $c, $con = null)
 {
     $c = clone $c;
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     PersonalWorktypePeer::addSelectColumns($c);
     $startcol2 = PersonalWorktypePeer::NUM_COLUMNS - PersonalWorktypePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     PersonalPeer::addSelectColumns($c);
     $startcol3 = $startcol2 + PersonalPeer::NUM_COLUMNS;
     $c->addJoin(PersonalWorktypePeer::PERSONAL_ID, PersonalPeer::ID);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = PersonalWorktypePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         $omClass = PersonalPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj2 = new $cls();
         $obj2->hydrate($rs, $startcol2);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj2 = $temp_obj1->getPersonal();
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addPersonalWorktype($obj1);
                 break;
             }
         }
         if ($newObject) {
             $obj2->initPersonalWorktypes();
             $obj2->addPersonalWorktype($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
예제 #2
0
 /**
  * Gets an array of Personal objects which contain a foreign key that references this object.
  *
  * If this collection has already been initialized with an identical Criteria, it returns the collection.
  * Otherwise if this Usuaris has previously been saved, it will retrieve
  * related PersonalsRelatedByUsuariupdateid from storage. If this Usuaris is new, it will return
  * an empty collection or the current collection, the criteria is ignored on a new object.
  *
  * @param      PropelPDO $con
  * @param      Criteria $criteria
  * @return     array Personal[]
  * @throws     PropelException
  */
 public function getPersonalsRelatedByUsuariupdateid($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(UsuarisPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPersonalsRelatedByUsuariupdateid === null) {
         if ($this->isNew()) {
             $this->collPersonalsRelatedByUsuariupdateid = array();
         } else {
             $criteria->add(PersonalPeer::USUARIUPDATEID, $this->usuariid);
             PersonalPeer::addSelectColumns($criteria);
             $this->collPersonalsRelatedByUsuariupdateid = PersonalPeer::doSelect($criteria, $con);
         }
     } else {
         // criteria has no effect for a new object
         if (!$this->isNew()) {
             // 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(PersonalPeer::USUARIUPDATEID, $this->usuariid);
             PersonalPeer::addSelectColumns($criteria);
             if (!isset($this->lastPersonalRelatedByUsuariupdateidCriteria) || !$this->lastPersonalRelatedByUsuariupdateidCriteria->equals($criteria)) {
                 $this->collPersonalsRelatedByUsuariupdateid = PersonalPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPersonalRelatedByUsuariupdateidCriteria = $criteria;
     return $this->collPersonalsRelatedByUsuariupdateid;
 }
예제 #3
0
 /**
  * Selects a collection of Personal objects pre-filled with all related objects except UsuarisRelatedByUsuariupdateid.
  *
  * @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 Personal objects.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAllExceptUsuarisRelatedByUsuariupdateid(Criteria $criteria, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     $criteria = clone $criteria;
     // Set the correct dbName if it has not been overridden
     // $criteria->getDbName() will return the same object if not set to another value
     // so == check is okay and faster
     if ($criteria->getDbName() == Propel::getDefaultDB()) {
         $criteria->setDbName(self::DATABASE_NAME);
     }
     PersonalPeer::addSelectColumns($criteria);
     $startcol2 = PersonalPeer::NUM_COLUMNS - PersonalPeer::NUM_LAZY_LOAD_COLUMNS;
     // symfony_behaviors behavior
     foreach (sfMixer::getCallables(self::getMixerPreSelectHook(__FUNCTION__)) as $sf_hook) {
         call_user_func($sf_hook, 'BasePersonalPeer', $criteria, $con);
     }
     $stmt = BasePeer::doSelect($criteria, $con);
     $results = array();
     while ($row = $stmt->fetch(PDO::FETCH_NUM)) {
         $key1 = PersonalPeer::getPrimaryKeyHashFromRow($row, 0);
         if (null !== ($obj1 = PersonalPeer::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 = PersonalPeer::getOMClass(false);
             $obj1 = new $cls();
             $obj1->hydrate($row);
             PersonalPeer::addInstanceToPool($obj1, $key1);
         }
         // if obj1 already loaded
         $results[] = $obj1;
     }
     $stmt->closeCursor();
     return $results;
 }
예제 #4
0
 public function getPersonals($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BasePersonalPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPersonals === null) {
         if ($this->isNew()) {
             $this->collPersonals = array();
         } else {
             $criteria->add(PersonalPeer::USER_ID, $this->getId());
             PersonalPeer::addSelectColumns($criteria);
             $this->collPersonals = PersonalPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(PersonalPeer::USER_ID, $this->getId());
             PersonalPeer::addSelectColumns($criteria);
             if (!isset($this->lastPersonalCriteria) || !$this->lastPersonalCriteria->equals($criteria)) {
                 $this->collPersonals = PersonalPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPersonalCriteria = $criteria;
     return $this->collPersonals;
 }