예제 #1
0
 public function getStrings()
 {
     $c = new Criteria();
     $c->addAscendingOrderByColumn(PcStringPeer::SORT_ORDER_IN_CATEGORY);
     $c->add(PcStringPeer::CATEGORY_ID, $this->getId());
     $c->add(PcStringPeer::IS_ARCHIVED, 0);
     return PcStringPeer::doSelect($c);
 }
예제 #2
0
 public static function getWebAppStrings()
 {
     $lang = PcLanguagePeer::getUserPreferredLanguage()->getId();
     $c = new Criteria();
     $c->add(PcStringPeer::CATEGORY_ID, array(115, 119), Criteria::NOT_IN);
     // Settings && GCal integration
     $c->add(PcStringPeer::IS_ARCHIVED, 0);
     $c->addJoin(PcStringPeer::CATEGORY_ID, PcStringCategoryPeer::ID);
     $c->add(PcStringCategoryPeer::IN_ACCOUNT, 1);
     $stringsFromAccount = PcStringPeer::doSelect($c);
     $c = new Criteria();
     $c->add(PcStringPeer::CATEGORY_ID, 2);
     // General
     $c->add(PcStringPeer::IS_ARCHIVED, 0);
     $c->addJoin(PcStringPeer::CATEGORY_ID, PcStringCategoryPeer::ID);
     $c->add(PcStringCategoryPeer::IN_ACCOUNT, 0);
     $c->add(PcStringCategoryPeer::IN_MISC, 0);
     return array_merge($stringsFromAccount, PcStringPeer::doSelect($c));
 }
 /**
  * Gets an array of PcString 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 PcStringCategory has previously been saved, it will retrieve
  * related PcStrings from storage. If this PcStringCategory 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 PcString[]
  * @throws     PropelException
  */
 public function getPcStrings($criteria = null, PropelPDO $con = null)
 {
     if ($criteria === null) {
         $criteria = new Criteria(PcStringCategoryPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collPcStrings === null) {
         if ($this->isNew()) {
             $this->collPcStrings = array();
         } else {
             $criteria->add(PcStringPeer::CATEGORY_ID, $this->id);
             PcStringPeer::addSelectColumns($criteria);
             $this->collPcStrings = PcStringPeer::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(PcStringPeer::CATEGORY_ID, $this->id);
             PcStringPeer::addSelectColumns($criteria);
             if (!isset($this->lastPcStringCriteria) || !$this->lastPcStringCriteria->equals($criteria)) {
                 $this->collPcStrings = PcStringPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastPcStringCriteria = $criteria;
     return $this->collPcStrings;
 }
예제 #4
0
 /**
  * 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(PcStringPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(PcStringPeer::DATABASE_NAME);
         $criteria->add(PcStringPeer::ID, $pks, Criteria::IN);
         $objs = PcStringPeer::doSelect($criteria, $con);
     }
     return $objs;
 }