/** * 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(EmailQueuePeer::DATABASE_NAME, Propel::CONNECTION_READ); } $objs = null; if (empty($pks)) { $objs = array(); } else { $criteria = new Criteria(EmailQueuePeer::DATABASE_NAME); $criteria->add(EmailQueuePeer::ID, $pks, Criteria::IN); $objs = EmailQueuePeer::doSelect($criteria, $con); } return $objs; }
/** * Gets an array of EmailQueue 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 Person has previously been saved, it will retrieve * related EmailQueues from storage. If this Person 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 EmailQueue[] * @throws PropelException */ public function getEmailQueues($criteria = null, PropelPDO $con = null) { if ($criteria === null) { $criteria = new Criteria(PersonPeer::DATABASE_NAME); } elseif ($criteria instanceof Criteria) { $criteria = clone $criteria; } if ($this->collEmailQueues === null) { if ($this->isNew()) { $this->collEmailQueues = array(); } else { $criteria->add(EmailQueuePeer::PERSON_ID, $this->id); EmailQueuePeer::addSelectColumns($criteria); $this->collEmailQueues = EmailQueuePeer::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(EmailQueuePeer::PERSON_ID, $this->id); EmailQueuePeer::addSelectColumns($criteria); if (!isset($this->lastEmailQueueCriteria) || !$this->lastEmailQueueCriteria->equals($criteria)) { $this->collEmailQueues = EmailQueuePeer::doSelect($criteria, $con); } } } $this->lastEmailQueueCriteria = $criteria; return $this->collEmailQueues; }
public function executeListEditBulkSentEmail(sfWebRequest $request) { #Security if (!$this->getUser()->hasCredential(array('Administrator', 'Staff'), false)) { $this->getUser()->setFlash("warning", 'You don\'t have permission to access this url ' . $request->getUri()); $this->redirect('dashboard/index'); } $this->max_array = array(5, 10, 20, 30); $this->max = $this->getMaxBulkQueuedEmailValuePerPage($request, $this->max_array); $this->page = $request->getParameter('page', 1); $c = new Criteria(); $c->add(EmailQueuePeer::SEND_STATUS, 'SENT'); $c->addJoin(EmailQueuePeer::LETTER_ID, EmailLetterPeer::ID, Criteria::LEFT_JOIN); $c->setOffset(($this->page - 1) * $this->max); $c->setLimit($this->max); $this->email_letters = EmailLetterPeer::doSelect($c); $this->email_sents = EmailQueuePeer::doSelect($c); $this->pager = EmailQueuePeer::getPager($this->max, $this->page, $c); $this->sent_email_lists = array(); foreach ($this->email_letters as $key => $item) { $this->sent_email_lists[$key]['send_date'] = $this->email_sents[$key]->getSendDate(); $this->sent_email_lists[$key]['subject'] = $item->getSubject(); $this->sent_email_lists[$key]['sender_name'] = $item->getSenderName(); $this->sent_email_lists[$key]['sender_email'] = $item->getSenderEmail(); $this->sent_email_lists[$key]['body'] = $item->getBody(); $this->sent_email_lists[$key]['attach_file_path'] = $item->getAttachFilePath(); $this->sent_email_lists[$key]['recipients'] = explode(',', $item->getRecipients()); if ($key >= $this->max - 1) { break; } } }