/** * 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(CollectionPeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(CollectionPeer::DATABASE_NAME); $criteria->add(CollectionPeer::ID, $pks, Criteria::IN); $objs = CollectionPeer::doSelect($criteria, $con); } return $objs; }
public function getCollections($criteria = null, $con = null) { include_once 'lib/model/om/BaseCollectionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collCollections === null) { if ($this->isNew()) { $this->collCollections = array(); } else { $criteria->add(CollectionPeer::CATALOG_ID, $this->getId()); CollectionPeer::addSelectColumns($criteria); $this->collCollections = CollectionPeer::doSelect($criteria, $con); } } else { if (!$this->isNew()) { $criteria->add(CollectionPeer::CATALOG_ID, $this->getId()); CollectionPeer::addSelectColumns($criteria); if (!isset($this->lastCollectionCriteria) || !$this->lastCollectionCriteria->equals($criteria)) { $this->collCollections = CollectionPeer::doSelect($criteria, $con); } } } $this->lastCollectionCriteria = $criteria; return $this->collCollections; }
/** * If this collection has already been initialized with * an identical criteria, it returns the collection. * Otherwise if this User has previously * been saved, it will retrieve related CollectionsRelatedByUpdatedUserId from storage. * If this User is new, it will return * an empty collection or the current collection, the criteria * is ignored on a new object. * * @param Connection $con * @param Criteria $criteria * @throws PropelException */ public function getCollectionsRelatedByUpdatedUserId($criteria = null, $con = null) { // include the Peer class include_once 'lib/model/om/BaseCollectionPeer.php'; if ($criteria === null) { $criteria = new Criteria(); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collCollectionsRelatedByUpdatedUserId === null) { if ($this->isNew()) { $this->collCollectionsRelatedByUpdatedUserId = array(); } else { $criteria->add(CollectionPeer::UPDATED_USER_ID, $this->getId()); CollectionPeer::addSelectColumns($criteria); $this->collCollectionsRelatedByUpdatedUserId = CollectionPeer::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(CollectionPeer::UPDATED_USER_ID, $this->getId()); CollectionPeer::addSelectColumns($criteria); if (!isset($this->lastCollectionRelatedByUpdatedUserIdCriteria) || !$this->lastCollectionRelatedByUpdatedUserIdCriteria->equals($criteria)) { $this->collCollectionsRelatedByUpdatedUserId = CollectionPeer::doSelect($criteria, $con); } } } $this->lastCollectionRelatedByUpdatedUserIdCriteria = $criteria; return $this->collCollectionsRelatedByUpdatedUserId; }