public function getCatalogWriters($criteria = null, $con = null) { include_once 'lib/model/om/BaseCatalogWriterPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collCatalogWriters === null) { if ($this->isNew()) { $this->collCatalogWriters = array(); } else { $criteria->add(CatalogWriterPeer::CATALOG_ID, $this->getId()); CatalogWriterPeer::addSelectColumns($criteria); $this->collCatalogWriters = CatalogWriterPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(CatalogWriterPeer::CATALOG_ID, $this->getId()); CatalogWriterPeer::addSelectColumns($criteria); if (!isset($this->lastCatalogWriterCriteria) || !$this->lastCatalogWriterCriteria->equals($criteria)) { $this->collCatalogWriters = CatalogWriterPeer::doSelect($criteria, $con); } } } $this->lastCatalogWriterCriteria = $criteria; return $this->collCatalogWriters; }
public static function retrieveByPK($catalog_id, $writer_id, $con = null) { if ($con === null) { $con = Propel::getConnection(self::DATABASE_NAME); } $criteria = new Criteria(); $criteria->add(CatalogWriterPeer::CATALOG_ID, $catalog_id); $criteria->add(CatalogWriterPeer::WRITER_ID, $writer_id); $v = CatalogWriterPeer::doSelect($criteria, $con); return !empty($v) ? $v[0] : null; }