本文整理匯總了PHP中Symfony\Component\EventDispatcher\Event::getEntity方法的典型用法代碼示例。如果您正苦於以下問題:PHP Event::getEntity方法的具體用法?PHP Event::getEntity怎麽用?PHP Event::getEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Symfony\Component\EventDispatcher\Event
的用法示例。
在下文中一共展示了Event::getEntity方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sendInvitationEmail
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);
}
示例2: processApacheTika
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');
}
示例3: createAvatarThumbnail
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');
}