示例#1
0
 /**
  * Get the associated ChildMilestone object
  *
  * @param  ConnectionInterface $con Optional Connection object.
  * @return ChildMilestone The associated ChildMilestone object.
  * @throws PropelException
  */
 public function getintroducedAt(ConnectionInterface $con = null)
 {
     if ($this->aintroducedAt === null && $this->introduced_at !== null) {
         $this->aintroducedAt = ChildMilestoneQuery::create()->findPk($this->introduced_at, $con);
         /* 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->aintroducedAt->addSnippets($this);
            */
     }
     return $this->aintroducedAt;
 }
示例#2
0
 /**
  * Move the object to the bottom of the list
  *
  * @param     ConnectionInterface $con optional connection
  *
  * @return integer the old object's rank
  */
 public function moveToBottom(ConnectionInterface $con = null)
 {
     if ($this->isLast($con)) {
         return false;
     }
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(MilestoneTableMap::DATABASE_NAME);
     }
     return $con->transaction(function () use($con) {
         $bottom = ChildMilestoneQuery::create()->getMaxRankArray($con);
         return $this->moveToRank($bottom, $con);
     });
 }
 /**
  * Performs an INSERT on the database, given a Milestone or Criteria object.
  *
  * @param mixed               $criteria Criteria or Milestone object containing data that is used to create the INSERT statement.
  * @param ConnectionInterface $con the ConnectionInterface connection to use
  * @return mixed           The new primary key.
  * @throws PropelException Any exceptions caught during processing will be
  *                         rethrown wrapped into a PropelException.
  */
 public static function doInsert($criteria, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getWriteConnection(MilestoneTableMap::DATABASE_NAME);
     }
     if ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
         // rename for clarity
     } else {
         $criteria = $criteria->buildCriteria();
         // build Criteria from Milestone object
     }
     if ($criteria->containsKey(MilestoneTableMap::COL_ID) && $criteria->keyContainsValue(MilestoneTableMap::COL_ID)) {
         throw new PropelException('Cannot insert a value for auto-increment primary key (' . MilestoneTableMap::COL_ID . ')');
     }
     // Set the correct dbName
     $query = MilestoneQuery::create()->mergeWith($criteria);
     // use transaction because $criteria could contain info
     // for more than one table (I guess, conceivably)
     return $con->transaction(function () use($con, $query) {
         return $query->doInsert($con);
     });
 }
示例#4
0
 /**
  * Returns the number of related Milestone objects.
  *
  * @param      Criteria $criteria
  * @param      boolean $distinct
  * @param      ConnectionInterface $con
  * @return int             Count of related Milestone objects.
  * @throws PropelException
  */
 public function countMilestones(Criteria $criteria = null, $distinct = false, ConnectionInterface $con = null)
 {
     $partial = $this->collMilestonesPartial && !$this->isNew();
     if (null === $this->collMilestones || null !== $criteria || $partial) {
         if ($this->isNew() && null === $this->collMilestones) {
             return 0;
         }
         if ($partial && !$criteria) {
             return count($this->getMilestones());
         }
         $query = ChildMilestoneQuery::create(null, $criteria);
         if ($distinct) {
             $query->distinct();
         }
         return $query->filterBywork($this)->count($con);
     }
     return count($this->collMilestones);
 }
 /**
  * Return an array of sortable objects ordered by position
  *
  * @param     Criteria  $criteria  optional criteria object
  * @param     string    $order     sorting order, to be chosen between Criteria::ASC (default) and Criteria::DESC
  * @param     ConnectionInterface $con       optional connection
  *
  * @return    array list of sortable objects
  */
 public static function doSelectOrderByRank(Criteria $criteria = null, $order = Criteria::ASC, ConnectionInterface $con = null)
 {
     if (null === $con) {
         $con = Propel::getServiceContainer()->getReadConnection(MilestoneTableMap::DATABASE_NAME);
     }
     if (null === $criteria) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->clearOrderByColumns();
     if (Criteria::ASC == $order) {
         $criteria->addAscendingOrderByColumn(MilestoneTableMap::RANK_COL);
     } else {
         $criteria->addDescendingOrderByColumn(MilestoneTableMap::RANK_COL);
     }
     return ChildMilestoneQuery::create(null, $criteria)->find($con);
 }