public function executeAjaxSubscribe(sfWebRequest $request) { $id = $request->getParameter('id'); $list_id = $request->getParameter('list_id'); $email_list_person = new EmailListPerson(); $email_list_person->setPersonId($id); $email_list_person->setListId($list_id); if (EmailListPersonPeer::doCount($email_list_person->buildCriteria())) { // what is this going to do? } else { $email_list_person->save(); } return $this->renderText($id); }
/** * Returns the number of related EmailListPerson objects. * * @param Criteria $criteria * @param boolean $distinct * @param PropelPDO $con * @return int Count of related EmailListPerson objects. * @throws PropelException */ public function countEmailListPersons(Criteria $criteria = null, $distinct = false, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(EmailListPeer::DATABASE_NAME); } else { $criteria = clone $criteria; } if ($distinct) { $criteria->setDistinct(); } $count = null; if ($this->collEmailListPersons === null) { if ($this->isNew()) { $count = 0; } else { $criteria->add(EmailListPersonPeer::LIST_ID, $this->id); $count = EmailListPersonPeer::doCount($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 count of the collection. $criteria->add(EmailListPersonPeer::LIST_ID, $this->id); if (!isset($this->lastEmailListPersonCriteria) || !$this->lastEmailListPersonCriteria->equals($criteria)) { $count = EmailListPersonPeer::doCount($criteria, $con); } else { $count = count($this->collEmailListPersons); } } else { $count = count($this->collEmailListPersons); } } return $count; }