コード例 #1
0
 public function process(WebhookEvent $event)
 {
     $data = $event->getData();
     if (!isset($data->entry_id)) {
         return null;
     }
     $entry = $this->entryRepository->find($data->entry_id);
     if (null === $entry) {
         return null;
     }
     $data = $event->getData();
     $feed = $entry->getFeed();
     $query = $this->userQuery;
     $query->include_phantoms(true)->include_invite(false)->include_templates(false)->email_not_null(true);
     if ($feed->getCollection($this->app)) {
         $query->on_base_ids([$feed->getCollection($this->app)->get_base_id()]);
     }
     $start = 0;
     $perLoop = 100;
     $users = [];
     do {
         $results = $query->limit($start, $perLoop)->execute()->get_results();
         foreach ($results as $user) {
             $users[] = ['email' => $user->getEmail(), 'firstname' => $user->getFirstname() ?: null, 'lastname' => $user->getLastname() ?: null];
         }
         $start += $perLoop;
     } while (count($results) > 0);
     return ['event' => $event->getName(), 'users_were_notified' => isset($data->notify_email) ?: (bool) $data->notify_email, 'feed' => ['id' => $feed->getId(), 'title' => $feed->getTitle(), 'description' => $feed->getSubtitle()], 'entry' => ['id' => $entry->getId(), 'author' => ['name' => $entry->getAuthorName(), 'email' => $entry->getAuthorEmail()], 'title' => $entry->getTitle(), 'description' => $entry->getSubtitle()], 'users' => $users];
 }
コード例 #2
0
 public function process(WebhookEvent $event)
 {
     $data = $event->getData();
     if (!isset($data['user_id'])) {
         return null;
     }
     $user = $this->userRepository->find($data['user_id']);
     return ['event' => $event->getName(), 'user' => ['id' => $user->getId(), 'email' => $user->getEmail(), 'login' => $user->getLogin()], 'granted' => $data['granted'], 'rejected' => $data['rejected']];
 }