예제 #1
0
 /**
  * Create or update an existing list with the given Mailchimp List ID from
  * Mailchimp.
  *
  * @param  string $mcListId List ID
  * @param  array  $data     Fields
  * @return void
  */
 public function addOrUpdateFromMailchimp($mcListId, array $data)
 {
     if (!($list = $this->findHiddenOneByMcListId($mcListId))) {
         $list = new Mlist();
         $list->setMcListId($mcListId);
         $list->setMcCreatedAt($data['mc_created_at']);
         $list->setName($data['name']);
         $this->add($list);
     } else {
         $list->setName($data['name']);
         $this->update($list);
     }
 }
예제 #2
0
 /**
  * Get the subscription status for the given email address and list.
  *
  * @param  string                               $email Email address
  * @param  \Tev\TevMailchimp\Domain\Model\Mlist $list  List to check
  * @return string|null                                 'subscribed', 'unsubscribed', 'pending', 'cleaned' or null if not subscribed at all
  */
 private function getSubscriptionStatus($email, Mlist $list)
 {
     try {
         $res = $this->mc->getMember($list->getMcListId(), $this->getMailchimpId($email));
         if (isset($res['id'])) {
             return $res['status'];
         } else {
             return null;
         }
     } catch (Exception $e) {
         return null;
     }
 }