/** * Gets an array of ImportMapping 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 EnumItem has previously been saved, it will retrieve * related ImportMappingsRelatedByMapping from storage. If this EnumItem 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 ImportMapping[] * @throws PropelException */ public function getImportMappingsRelatedByMapping($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(EnumItemPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collImportMappingsRelatedByMapping === null) { if ($this->isNew()) { $this->collImportMappingsRelatedByMapping = array(); } else { $criteria->add(ImportMappingPeer::MAPPING, $this->id); ImportMappingPeer::addSelectColumns($criteria); $this->collImportMappingsRelatedByMapping = ImportMappingPeer::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(ImportMappingPeer::MAPPING, $this->id); ImportMappingPeer::addSelectColumns($criteria); if (!isset($this->lastImportMappingRelatedByMappingCriteria) || !$this->lastImportMappingRelatedByMappingCriteria->equals($criteria)) { $this->collImportMappingsRelatedByMapping = ImportMappingPeer::doSelect($criteria, $con); } } } $this->lastImportMappingRelatedByMappingCriteria = $criteria; return $this->collImportMappingsRelatedByMapping; }
/** * Retrieve object using using composite pkey values. * @param int $column @param int $import_file_type * @param PropelPDO $con * @return ImportMapping */ public static function retrieveByPK($column, $import_file_type, PropelPDO $con = null) { $key = serialize(array((string) $column, (string) $import_file_type)); if (null !== ($obj = ImportMappingPeer::getInstanceFromPool($key))) { return $obj; } if ($con === null) { $con = Propel::getConnection(ImportMappingPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $criteria = new Criteria(ImportMappingPeer::DATABASE_NAME); $criteria->add(ImportMappingPeer::COLUMN, $column); $criteria->add(ImportMappingPeer::IMPORT_FILE_TYPE, $import_file_type); $v = ImportMappingPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }