/** * @param int $partner_id * @return conversionProfile2 */ public static function getConversionProfile2ForPartner($partner_id, $conversionProfile2Id = null) { if ($conversionProfile2Id == conversionProfile2::CONVERSION_PROFILE_NONE) { return null; } if (!$conversionProfile2Id) { // try to extract the conversion profile from the partner $partner = PartnerPeer::retrieveByPK($partner_id); if (!$partner) { throw new Exception("Cannot find partner for id [{$partner_id}]"); } $partner_kmc_version = $partner->getKmcVersion(); if (is_null($partner_kmc_version) || version_compare($partner_kmc_version, "2", "<")) { $old_conversion_profile = self::getCurrentConversionProfile($partner->getId()); if (!$old_conversion_profile) { throw new Exception("Cannot find conversion profile for partner id [{$partner_id}]"); } return myConversionProfileUtils::createConversionProfile2FromConversionProfile($old_conversion_profile); } $conversionProfile2Id = $partner->getDefaultConversionProfileId(); } return conversionProfile2Peer::retrieveByPk($conversionProfile2Id); }
/** * Get the associated conversionProfile2 object * * @param PropelPDO Optional Connection object. * @return conversionProfile2 The associated conversionProfile2 object. * @throws PropelException */ public function getconversionProfile2(PropelPDO $con = null) { if ($this->aconversionProfile2 === null && $this->conversion_profile_id !== null) { $this->aconversionProfile2 = conversionProfile2Peer::retrieveByPk($this->conversion_profile_id); /* 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->aconversionProfile2->addentrys($this); */ } return $this->aconversionProfile2; }