Пример #1
0
 public function executeIndex()
 {
     if ($this->hasRequestParameter('faq_id')) {
         $this->setVar('selectedFaq', sfFaqFaqPeer::retrieveByPk($this->getRequestParameter('faq_id')));
         if (!$this->selectedFaq->getsfFaqCategory()->getActivate()) {
             $this->redirect('sfFaq/index');
         }
     }
     if (!isset($this->selectedFaq) && !$this->selectedFaq) {
         if ($this->hasRequestParameter('category_id')) {
             $this->setVar('selectedCategory', sfFaqCategoryPeer::retrieveByPk($this->getRequestParameter('category_id')));
             if (!$this->selectedCategory->getActivate()) {
                 $this->redirect('sfFaq/index');
             }
             $this->defaultQuestionSelection();
         } else {
             $this->defaultSelection();
         }
     } else {
         $this->setVar('selectedCategory', $this->selectedFaq->getsfFaqCategory());
     }
 }
Пример #2
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(sfFaqFaqPeer::ID, $pks, Criteria::IN);
         $objs = sfFaqFaqPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
Пример #3
0
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = sfFaqFaqPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setQuestion($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setAnswer($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCategoryId($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setCreatedAt($arr[$keys[4]]);
     }
 }
Пример #4
0
 public function countsfFaqFaqs($criteria = null, $distinct = false, $con = null)
 {
     include_once 'plugins/sfFaqPlugin/lib/model/om/BasesfFaqFaqPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     $criteria->add(sfFaqFaqPeer::CATEGORY_ID, $this->getId());
     return sfFaqFaqPeer::doCount($criteria, $distinct, $con);
 }