/** * Populates the object using an array. * * This is particularly useful when populating an object from one of the * request arrays (e.g. $_POST). This method goes through the column * names, checking to see whether a matching key exists in populated * array. If so the setByName() method is called for that column. * * You can specify the key type of the array by additionally passing one * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME, * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM. * The default key type is the column's phpname (e.g. 'AuthorId') * * @param array $arr An array to populate the object from. * @param string $keyType The type of keys the array uses. * @return void */ public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME) { $keys = VpoRequestPeer::getFieldNames($keyType); if (array_key_exists($keys[0], $arr)) { $this->setId($arr[$keys[0]]); } if (array_key_exists($keys[1], $arr)) { $this->setHazardousCargoFlag($arr[$keys[1]]); } if (array_key_exists($keys[2], $arr)) { $this->setRequestDate($arr[$keys[2]]); } if (array_key_exists($keys[3], $arr)) { $this->setRequestReasonDesc($arr[$keys[3]]); } if (array_key_exists($keys[4], $arr)) { $this->setAgencyName($arr[$keys[4]]); } if (array_key_exists($keys[5], $arr)) { $this->setReqFirstName($arr[$keys[5]]); } if (array_key_exists($keys[6], $arr)) { $this->setReqLastName($arr[$keys[6]]); } if (array_key_exists($keys[7], $arr)) { $this->setAgencyDivision($arr[$keys[7]]); } if (array_key_exists($keys[8], $arr)) { $this->setReqAddress1($arr[$keys[8]]); } if (array_key_exists($keys[9], $arr)) { $this->setReqAddress2($arr[$keys[9]]); } if (array_key_exists($keys[10], $arr)) { $this->setReqCity($arr[$keys[10]]); } if (array_key_exists($keys[11], $arr)) { $this->setReqState($arr[$keys[11]]); } if (array_key_exists($keys[12], $arr)) { $this->setReqCountry($arr[$keys[12]]); } if (array_key_exists($keys[13], $arr)) { $this->setReqZipcode($arr[$keys[13]]); } if (array_key_exists($keys[14], $arr)) { $this->setReqOfficePhone($arr[$keys[14]]); } if (array_key_exists($keys[15], $arr)) { $this->setReqOfficeComment($arr[$keys[15]]); } if (array_key_exists($keys[16], $arr)) { $this->setReqMobilePhone($arr[$keys[16]]); } if (array_key_exists($keys[17], $arr)) { $this->setReqMobileComment($arr[$keys[17]]); } if (array_key_exists($keys[18], $arr)) { $this->setReqFaxPhone($arr[$keys[18]]); } if (array_key_exists($keys[19], $arr)) { $this->setReqFaxComment($arr[$keys[19]]); } if (array_key_exists($keys[20], $arr)) { $this->setReqPagerPhone($arr[$keys[20]]); } if (array_key_exists($keys[21], $arr)) { $this->setReqPagerComment($arr[$keys[21]]); } if (array_key_exists($keys[22], $arr)) { $this->setReqOtherPhone1($arr[$keys[22]]); } if (array_key_exists($keys[23], $arr)) { $this->setReqOtherComment1($arr[$keys[23]]); } if (array_key_exists($keys[24], $arr)) { $this->setReqOtherPhone2($arr[$keys[24]]); } if (array_key_exists($keys[25], $arr)) { $this->setReqOtherComment2($arr[$keys[25]]); } if (array_key_exists($keys[26], $arr)) { $this->setReqOtherPhone3($arr[$keys[26]]); } if (array_key_exists($keys[27], $arr)) { $this->setReqOtherComment3($arr[$keys[27]]); } if (array_key_exists($keys[28], $arr)) { $this->setReqEmail($arr[$keys[28]]); } if (array_key_exists($keys[29], $arr)) { $this->setReqAltEmail($arr[$keys[29]]); } if (array_key_exists($keys[30], $arr)) { $this->setContactNotes($arr[$keys[30]]); } if (array_key_exists($keys[31], $arr)) { $this->setOriginCity($arr[$keys[31]]); } if (array_key_exists($keys[32], $arr)) { $this->setOriginState($arr[$keys[32]]); } if (array_key_exists($keys[33], $arr)) { $this->setDestCity($arr[$keys[33]]); } if (array_key_exists($keys[34], $arr)) { $this->setDestState($arr[$keys[34]]); } if (array_key_exists($keys[35], $arr)) { $this->setPreferredDate($arr[$keys[35]]); } if (array_key_exists($keys[36], $arr)) { $this->setAlternativeDate($arr[$keys[36]]); } if (array_key_exists($keys[37], $arr)) { $this->setTransportType($arr[$keys[37]]); } if (array_key_exists($keys[38], $arr)) { $this->setRequestPostedDate($arr[$keys[38]]); } if (array_key_exists($keys[39], $arr)) { $this->setRequestPostedToAfaOrgId($arr[$keys[39]]); } if (array_key_exists($keys[40], $arr)) { $this->setRequesProcessedDate($arr[$keys[40]]); } if (array_key_exists($keys[41], $arr)) { $this->setRequestDisposition($arr[$keys[41]]); } if (array_key_exists($keys[42], $arr)) { $this->setCallerName($arr[$keys[42]]); } if (array_key_exists($keys[43], $arr)) { $this->setCallerPhone($arr[$keys[43]]); } if (array_key_exists($keys[44], $arr)) { $this->setRequestPostResults($arr[$keys[44]]); } if (array_key_exists($keys[45], $arr)) { $this->setRequesterVpoUserId($arr[$keys[45]]); } if (array_key_exists($keys[46], $arr)) { $this->setSource($arr[$keys[46]]); } if (array_key_exists($keys[47], $arr)) { $this->setSoapPostFromAfaOrgId($arr[$keys[47]]); } if (array_key_exists($keys[48], $arr)) { $this->setSoapPostRequestId($arr[$keys[48]]); } if (array_key_exists($keys[49], $arr)) { $this->setRequestProcessedBy($arr[$keys[49]]); } }
/** * Selects a collection of VpoRequestPassenger objects pre-filled with all related objects. * * @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 VpoRequestPassenger objects. * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function doSelectJoinAll(Criteria $c, $con = null, $join_behavior = Criteria::LEFT_JOIN) { foreach (sfMixer::getCallables('BaseVpoRequestPassengerPeer:doSelectJoinAll:doSelectJoinAll') as $callable) { call_user_func($callable, 'BaseVpoRequestPassengerPeer', $c, $con); } $c = clone $c; // Set the correct dbName if it has not been overridden if ($c->getDbName() == Propel::getDefaultDB()) { $c->setDbName(self::DATABASE_NAME); } VpoRequestPassengerPeer::addSelectColumns($c); $startcol2 = VpoRequestPassengerPeer::NUM_COLUMNS - VpoRequestPassengerPeer::NUM_LAZY_LOAD_COLUMNS; VpoRequestPeer::addSelectColumns($c); $startcol3 = $startcol2 + (VpoRequestPeer::NUM_COLUMNS - VpoRequestPeer::NUM_LAZY_LOAD_COLUMNS); $c->addJoin(array(VpoRequestPassengerPeer::REQUEST_ID), array(VpoRequestPeer::ID), $join_behavior); $stmt = BasePeer::doSelect($c, $con); $results = array(); while ($row = $stmt->fetch(PDO::FETCH_NUM)) { $key1 = VpoRequestPassengerPeer::getPrimaryKeyHashFromRow($row, 0); if (null !== ($obj1 = VpoRequestPassengerPeer::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 = VpoRequestPassengerPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj1 = new $cls(); $obj1->hydrate($row); VpoRequestPassengerPeer::addInstanceToPool($obj1, $key1); } // if obj1 already loaded // Add objects for joined VpoRequest rows $key2 = VpoRequestPeer::getPrimaryKeyHashFromRow($row, $startcol2); if ($key2 !== null) { $obj2 = VpoRequestPeer::getInstanceFromPool($key2); if (!$obj2) { $omClass = VpoRequestPeer::getOMClass(); $cls = substr('.' . $omClass, strrpos('.' . $omClass, '.') + 1); $obj2 = new $cls(); $obj2->hydrate($row, $startcol2); VpoRequestPeer::addInstanceToPool($obj2, $key2); } // if obj2 loaded // Add the $obj1 (VpoRequestPassenger) to the collection in $obj2 (VpoRequest) $obj2->addVpoRequestPassenger($obj1); } // if joined row not null $results[] = $obj1; } $stmt->closeCursor(); return $results; }
/** * Get the associated VpoRequest object * * @param PropelPDO Optional Connection object. * @return VpoRequest The associated VpoRequest object. * @throws PropelException */ public function getVpoRequest(PropelPDO $con = null) { if ($this->aVpoRequest === null && $this->request_id !== null) { $c = new Criteria(VpoRequestPeer::DATABASE_NAME); $c->add(VpoRequestPeer::ID, $this->request_id); $this->aVpoRequest = VpoRequestPeer::doSelectOne($c, $con); /* The following can be used additionally to guarantee the related object contains a reference to this object. This level of coupling may, however, be undesirable since it could result in an only partially populated collection in the referenced object. $this->aVpoRequest->addVpoRequestCargos($this); */ } return $this->aVpoRequest; }
/** * Retrieve multiple objects by pkey. * * @param array $pks List of primary keys * @param PropelPDO $con the connection to use * @throws PropelException Any exceptions caught during processing will be * rethrown wrapped into a PropelException. */ public static function retrieveByPKs($pks, PropelPDO $con = null) { if ($con === null) { $con = Propel::getConnection(VpoRequestPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(VpoRequestPeer::DATABASE_NAME); $criteria->add(VpoRequestPeer::ID, $pks, Criteria::IN); $objs = VpoRequestPeer::doSelect($criteria, $con); } return $objs; }