예제 #1
0
 private function sendChangeEmails(Show $show, PreUpdateEventArgs $event)
 {
     $authorisationEmailSent = false;
     if ($event->hasChangedField('society') && $show->getSociety() instanceof Society) {
         if ($show->isAuthorised()) {
             $this->moderationManager->notifySocietyChanged($show);
         } else {
             $this->moderationManager->autoApproveOrEmailModerators($show);
             $authorisationEmailSent = true;
         }
     }
     if ($event->hasChangedField('venue') && $show->getVenue() instanceof Venue) {
         if ($show->isAuthorised()) {
             $this->moderationManager->notifyVenueChanged($show);
         } elseif (!$authorisationEmailSent) {
             $this->moderationManager->autoApproveOrEmailModerators($show);
         }
     }
 }
예제 #2
0
 public function autoApproveOrEmailModerators(Show $entity)
 {
     if (!$entity->isAuthorised()) {
         if ($this->authorizationChecker->isGranted('APPROVE', $entity)) {
             //The current user is able to approve the show, so approve it straight away.
             $this->approveEntity($entity);
         } else {
             //Else Send an email
             $this->emailEntityModerators($entity);
         }
     }
 }