Beispiel #1
0
 /**
  * Gets an array of Featurevector 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 Track has previously been saved, it will retrieve
  * related Featurevectors from storage. If this Track 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 Featurevector[]
  * @throws     PropelException
  */
 public function getFeaturevectors($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(TrackPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collFeaturevectors === null) {
         if ($this->isNew()) {
             $this->collFeaturevectors = array();
         } else {
             $criteria->add(FeaturevectorPeer::TRACK_ID, $this->id);
             FeaturevectorPeer::addSelectColumns($criteria);
             $this->collFeaturevectors = FeaturevectorPeer::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(FeaturevectorPeer::TRACK_ID, $this->id);
             FeaturevectorPeer::addSelectColumns($criteria);
             if (!isset($this->lastFeaturevectorCriteria) || !$this->lastFeaturevectorCriteria->equals($criteria)) {
                 $this->collFeaturevectors = FeaturevectorPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastFeaturevectorCriteria = $criteria;
     return $this->collFeaturevectors;
 }
Beispiel #2
0
 /**
  * Retrieve object using using composite pkey values.
  * @param      int $track_id
  * @param      int $featurevectortype_id
  * @param      PropelPDO $con
  * @return     Featurevector
  */
 public static function retrieveByPK($track_id, $featurevectortype_id, PropelPDO $con = null)
 {
     $key = serialize(array((string) $track_id, (string) $featurevectortype_id));
     if (null !== ($obj = FeaturevectorPeer::getInstanceFromPool($key))) {
         return $obj;
     }
     if ($con === null) {
         $con = Propel::getConnection(FeaturevectorPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $criteria = new Criteria(FeaturevectorPeer::DATABASE_NAME);
     $criteria->add(FeaturevectorPeer::TRACK_ID, $track_id);
     $criteria->add(FeaturevectorPeer::FEATUREVECTORTYPE_ID, $featurevectortype_id);
     $v = FeaturevectorPeer::doSelect($criteria, $con);
     return !empty($v) ? $v[0] : null;
 }