/**
  * Selects a collection of Profile objects pre-filled with all related objects.
  *
  * @return array Array of Profile objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     ProfilePeer::addSelectColumns($c);
     $startcol2 = ProfilePeer::NUM_COLUMNS - ProfilePeer::NUM_LAZY_LOAD_COLUMNS + 1;
     AgentPeer::addSelectColumns($c, 'a1');
     $startcol3 = $startcol2 + AgentPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::AGENT_ID, AgentPeer::alias('a1', AgentPeer::ID));
     $c->addAlias('a1', AgentPeer::TABLE_NAME);
     UserPeer::addSelectColumns($c, 'a2');
     $startcol4 = $startcol3 + UserPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::CREATED_BY, UserPeer::alias('a2', UserPeer::ID));
     $c->addAlias('a2', UserPeer::TABLE_NAME);
     UserPeer::addSelectColumns($c, 'a3');
     $startcol5 = $startcol4 + UserPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::UPDATED_BY, UserPeer::alias('a3', UserPeer::ID));
     $c->addAlias('a3', UserPeer::TABLE_NAME);
     UserPeer::addSelectColumns($c, 'a4');
     $startcol6 = $startcol5 + UserPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::DELETED_BY, UserPeer::alias('a4', UserPeer::ID));
     $c->addAlias('a4', UserPeer::TABLE_NAME);
     UserPeer::addSelectColumns($c, 'a5');
     $startcol7 = $startcol6 + UserPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::CHILD_UPDATED_BY, UserPeer::alias('a5', UserPeer::ID));
     $c->addAlias('a5', UserPeer::TABLE_NAME);
     StatusPeer::addSelectColumns($c, 'a6');
     $startcol8 = $startcol7 + StatusPeer::NUM_COLUMNS;
     $c->addJoin(ProfilePeer::STATUS_ID, StatusPeer::alias('a6', StatusPeer::ID));
     $c->addAlias('a6', StatusPeer::TABLE_NAME);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = ProfilePeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         // Add objects for joined Agent rows
         $omClass = AgentPeer::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->getAgent();
             // CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addProfile($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj2->initProfiles();
             $obj2->addProfile($obj1);
         }
         // Add objects for joined User rows
         $omClass = UserPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getUserRelatedByCreatedBy();
             // CHECKME
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addProfileRelatedByCreatedBy($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj3->initProfilesRelatedByCreatedBy();
             $obj3->addProfileRelatedByCreatedBy($obj1);
         }
         // Add objects for joined User rows
         $omClass = UserPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj4 = new $cls();
         $obj4->hydrate($rs, $startcol4);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj4 = $temp_obj1->getUserRelatedByUpdatedBy();
             // CHECKME
             if ($temp_obj4->getPrimaryKey() === $obj4->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj4->addProfileRelatedByUpdatedBy($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj4->initProfilesRelatedByUpdatedBy();
             $obj4->addProfileRelatedByUpdatedBy($obj1);
         }
         // Add objects for joined User rows
         $omClass = UserPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj5 = new $cls();
         $obj5->hydrate($rs, $startcol5);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj5 = $temp_obj1->getUserRelatedByDeletedBy();
             // CHECKME
             if ($temp_obj5->getPrimaryKey() === $obj5->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj5->addProfileRelatedByDeletedBy($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj5->initProfilesRelatedByDeletedBy();
             $obj5->addProfileRelatedByDeletedBy($obj1);
         }
         // Add objects for joined User rows
         $omClass = UserPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj6 = new $cls();
         $obj6->hydrate($rs, $startcol6);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj6 = $temp_obj1->getUserRelatedByChildUpdatedBy();
             // CHECKME
             if ($temp_obj6->getPrimaryKey() === $obj6->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj6->addProfileRelatedByChildUpdatedBy($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj6->initProfilesRelatedByChildUpdatedBy();
             $obj6->addProfileRelatedByChildUpdatedBy($obj1);
         }
         // Add objects for joined Status rows
         $omClass = StatusPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj7 = new $cls();
         $obj7->hydrate($rs, $startcol7);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj7 = $temp_obj1->getStatus();
             // CHECKME
             if ($temp_obj7->getPrimaryKey() === $obj7->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj7->addProfile($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj7->initProfiles();
             $obj7->addProfile($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }
 /**
  * Add all the columns needed to create a new object.
  *
  * Note: any columns that were marked with lazyLoad="true" in the
  * XML schema will not be added to the select list and only loaded
  * on demand.
  *
  * @param      criteria object containing the columns to add.
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function addSelectColumns(Criteria $criteria, $tableAlias = null)
 {
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::ID) : AgentPeer::ID);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::CREATED_AT) : AgentPeer::CREATED_AT);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::LAST_UPDATED) : AgentPeer::LAST_UPDATED);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::DELETED_AT) : AgentPeer::DELETED_AT);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::ORG_EMAIL) : AgentPeer::ORG_EMAIL);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::ORG_NAME) : AgentPeer::ORG_NAME);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::IND_AFFILIATION) : AgentPeer::IND_AFFILIATION);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::IND_ROLE) : AgentPeer::IND_ROLE);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::ADDRESS1) : AgentPeer::ADDRESS1);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::ADDRESS2) : AgentPeer::ADDRESS2);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::CITY) : AgentPeer::CITY);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::STATE) : AgentPeer::STATE);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::POSTAL_CODE) : AgentPeer::POSTAL_CODE);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::COUNTRY) : AgentPeer::COUNTRY);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::PHONE) : AgentPeer::PHONE);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::WEB_ADDRESS) : AgentPeer::WEB_ADDRESS);
     $criteria->addSelectColumn($tableAlias ? AgentPeer::alias($tableAlias, AgentPeer::TYPE) : AgentPeer::TYPE);
 }
 /**
  * Selects a collection of AgentHasUser objects pre-filled with all related objects.
  *
  * @return array Array of AgentHasUser objects.
  * @throws PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function doSelectJoinAll(Criteria $c, $con = null)
 {
     $c = clone $c;
     // Set the correct dbName if it has not been overridden
     if ($c->getDbName() == Propel::getDefaultDB()) {
         $c->setDbName(self::DATABASE_NAME);
     }
     AgentHasUserPeer::addSelectColumns($c);
     $startcol2 = AgentHasUserPeer::NUM_COLUMNS - AgentHasUserPeer::NUM_LAZY_LOAD_COLUMNS + 1;
     UserPeer::addSelectColumns($c, 'a1');
     $startcol3 = $startcol2 + UserPeer::NUM_COLUMNS;
     $c->addJoin(AgentHasUserPeer::USER_ID, UserPeer::alias('a1', UserPeer::ID));
     $c->addAlias('a1', UserPeer::TABLE_NAME);
     AgentPeer::addSelectColumns($c, 'a2');
     $startcol4 = $startcol3 + AgentPeer::NUM_COLUMNS;
     $c->addJoin(AgentHasUserPeer::AGENT_ID, AgentPeer::alias('a2', AgentPeer::ID));
     $c->addAlias('a2', AgentPeer::TABLE_NAME);
     $rs = BasePeer::doSelect($c, $con);
     $results = array();
     while ($rs->next()) {
         $omClass = AgentHasUserPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj1 = new $cls();
         $obj1->hydrate($rs);
         // Add objects for joined User rows
         $omClass = UserPeer::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->getUser();
             // CHECKME
             if ($temp_obj2->getPrimaryKey() === $obj2->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj2->addAgentHasUser($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj2->initAgentHasUsers();
             $obj2->addAgentHasUser($obj1);
         }
         // Add objects for joined Agent rows
         $omClass = AgentPeer::getOMClass();
         $cls = Propel::import($omClass);
         $obj3 = new $cls();
         $obj3->hydrate($rs, $startcol3);
         $newObject = true;
         for ($j = 0, $resCount = count($results); $j < $resCount; $j++) {
             $temp_obj1 = $results[$j];
             $temp_obj3 = $temp_obj1->getAgent();
             // CHECKME
             if ($temp_obj3->getPrimaryKey() === $obj3->getPrimaryKey()) {
                 $newObject = false;
                 $temp_obj3->addAgentHasUser($obj1);
                 // CHECKME
                 break;
             }
         }
         if ($newObject) {
             $obj3->initAgentHasUsers();
             $obj3->addAgentHasUser($obj1);
         }
         $results[] = $obj1;
     }
     return $results;
 }