예제 #1
0
 protected function apiAddContactList(NewsletterEvent $event, MailjetNewsletter $model)
 {
     $params = ["ContactID" => $model->getId(), "ListALT" => ConfigQuery::read(MailjetModule::CONFIG_NEWSLETTER_LIST), "IsActive" => "True", "IsUnsubscribed" => "False"];
     if ($model->isNew()) {
         list($status, $data) = $this->api->post(MailjetClient::RESOURCE_LIST_RECIPIENT, $params);
     } else {
         list($status, $data) = $this->api->put(MailjetClient::RESOURCE_LIST_RECIPIENT, $model->getRelationId(), $params);
     }
     $this->logAfterAction(sprintf("The following email address has been added into mailjet list.", $event->getEmail()), sprintf("The following email address has been refused by mailjet for addition in the list.", $event->getEmail()), $status);
     $data = json_decode($data, true);
     $model->setRelationId($data["Data"][0]["ID"])->save();
 }
예제 #2
0
 /**
  * Exclude object from result
  *
  * @param   ChildMailjetNewsletter $mailjetNewsletter Object to remove from the list of results
  *
  * @return ChildMailjetNewsletterQuery The current query, for fluid interface
  */
 public function prune($mailjetNewsletter = null)
 {
     if ($mailjetNewsletter) {
         $this->addUsingAlias(MailjetNewsletterTableMap::ID, $mailjetNewsletter->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }