Exemplo n.º 1
0
 public function sendInvitationEmail(Event $event)
 {
     $invitation = $event->getEntity();
     if (!$invitation instanceof Invitation) {
         return;
     }
     $html = $this->templating->render('AppBundle:Email:invitation.html.twig', ['invitation' => $invitation, 'user' => $this->getUser(), 'permalink' => $this->generateUrl('user_signup_with_invite', [], true) . "?invitation=" . $invitation->getCode()]);
     $message = $this->mandrillMessage->setFromName($tenantHelper->getCurrentTenant())->addTo($invitation->getEmail())->setSubject('Invitation from ' . $invitation->getTenant())->setHtml($html);
     $mandrillDispatcher->send($message);
 }
Exemplo n.º 2
0
 public function processApacheTika(Event $event)
 {
     $file = $event->getEntity();
     if (!$file instanceof File) {
         return;
     }
     $tika = $this->tikaWrapper;
     $plaintext = $tika::getText($file->getPath() . DIRECTORY_SEPARATOR . $file->getName());
     $file->setText($plaintext);
     $this->fileManager->simpleSave($file, 'app.file.tika_indexed');
 }
Exemplo n.º 3
0
 public function createAvatarThumbnail(Event $event)
 {
     $file = $event->getEntity();
     $user = $this->tokenStorage->getToken()->getUser();
     if (!$file instanceof File) {
         return;
     }
     if ($user->getAvatar() !== $file) {
         return;
     }
     $binary = new Binary(file_get_contents($file->getPath()), $file->getMimeType(), 'png');
     $thumb = $this->imagineFilterManager->applyFilter($binary, 'avatar')->getContent();
     $f = fopen($file->getPath(), 'w');
     fwrite($f, $thumb);
     fclose($f);
     $size = filesize($file->getPath());
     $file->setSize($size);
     $this->fileManager->simpleSave($file, 'app.avatar.created');
 }