程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了PDF 文档创建 EasyAdmin symfony 5大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决PDF 文档创建 EasyAdmin symfony 5?

开发过程中遇到PDF 文档创建 EasyAdmin symfony 5的问题如何解决?下面主要结合日常开发的经验,给出你关于PDF 文档创建 EasyAdmin symfony 5的解决方法建议,希望对你解决PDF 文档创建 EasyAdmin symfony 5有所启发或帮助;

我有这个配置,它允许我在 CRUD 中创建一个 pdf 文档,有没有办法在 CRUD easyadmin 中添加这个代码,或者将我的 Easyadmin 文档的 CRUD 链接到 symfony 的 CRUD。 我在 Easyadmin 表中创建文档时遇到问题@H_772_3@

documentController.php@H_772_3@ @H_675_8@@H_607_9@<?php namespace App\Controller; use App\Entity\document; use App\Form\documentType; use App\Repository\documentRepository; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use App\service\fileUploader; use Symfony\Component\httpFoundation\request; use Symfony\Component\httpFoundation\Response; use Symfony\Component\RoutIng\Annotation\Route; use Sensio\Bundle\FrameworkExtraBundle\Configuration\IsGranted; /** * @IsGranted("RolE_USER") * @Route("/documents") */ class documentController extends AbstractController { /** * @Route("/",name="document_index",methods={"GET"}) */ public function index(documentRepository $documentRepository): Response { return $this->render('document/index.HTMl.twig',[ 'documents' => $documentRepository->findAll([],['created_at' => 'desc']),]); } /** * @Route("/new",name="document_new",methods={"GET","POST"}) */ public function new(request $request,fileUploader $fileUploader): Response { $document = new document(); $document->setCreatedAt(new \datetiR_18_11845@e('Now')); $form = $this->createForm(documentType::class,$document); $form->handlerequest($request); if ($form->issubmitted() && $form->isValID()) { $entitymanager = $this->getDoctrine()->getManager(); $file = $form['filedocument']->getData(); $originalfilename = pathinfo($file->getClIEntOriginalname(),PATHINFO_fileName); // this is needed to safely include the file name as part of the URL $filename = transliterator_transliterate('Any-LaTin; LaTin-ASCII; [^A-Za-z0-9_] remove; Lower()',$originalfileName); $filename = md5(uniqID()) . '.' . $file->guessExtension(); $file->move( $this->getParameter('brochures_directory'),$filename ); $document->setfiledocument($fileName); $entitymanager->persist($document); $entitymanager->flush(); return $this->redirectToRoute('document_index',array('ID' => $document->getID())); } return $this->render('document/new.HTMl.twig',[ // 'document' => $document,'form' => $form->createVIEw(),]); } /** * @Route("/{ID}",name="document_show",methods={"GET"}) */ public function show(document $document): Response { return $this->render('document/show.HTMl.twig',[ 'document' => $document,]); } /** * @Route("/{ID}/edit",name="document_edit","POST"}) */ public function edit(request $request,document $document): Response { $form = $this->createForm(documentType::class,$document); $form->handlerequest($request); if ($form->issubmitted() && $form->isValID()) { $file = $form['filedocument']->getData(); $originalfilename = pathinfo($file->getClIEntOriginalname(),$filename ); $document->setfiledocument($fileName); $this->getDoctrine()->getManager()->flush(); return $this->redirectToRoute('document_index'); } return $this->render('document/edit.HTMl.twig',name="document_delete",methods={"deletE"}) */ public function delete(request $request,document $document): Response { if ($this->isCsrftokenValID('delete' . $document->getID(),$request->request->get('_token'))) { $entitymanager = $this->getDoctrine()->getManager(); $entitymanager->remove($document); $entitymanager->flush(); } return $this->redirectToRoute('document_index'); } }

documentCrudController 轻松管理@H_772_3@ @H_675_8@@H_607_9@<?php namespace App\Controller\admin; use App\Entity\document; use App\Entity\Publication; use EasyCorp\Bundle\EasyadminBundle\Config\Action; use EasyCorp\Bundle\EasyadminBundle\Config\Actions; use EasyCorp\Bundle\EasyadminBundle\Config\Crud; use EasyCorp\Bundle\EasyadminBundle\Controller\AbstractCrudController; use EasyCorp\Bundle\EasyadminBundle\FIEld\datetiR_18_11845@eFIEld; use EasyCorp\Bundle\EasyadminBundle\FIEld\IDFIEld; use EasyCorp\Bundle\EasyadminBundle\FIEld\ImageFIEld; use EasyCorp\Bundle\EasyadminBundle\FIEld\TextareaFIEld; use EasyCorp\Bundle\EasyadminBundle\FIEld\TextFIEld; use Symfony\Component\Form\Extension\Core\Type\fileType; use Symfony\Component\ValIDator\ConsTraints\file; class documentCrudController extends AbstractCrudController { public static function getEntityFqcn(): String { return document::class; } public function configureCrud(Crud $crud): Crud { return $crud ->setPagetitle(Crud::PAGE_INDEX,'Liste de documents') ; } public function configureFIElds(String $pageName): iterable { ImageFIEld::new('filedocument','document pdf')->setFormType(fileType::class) ->setBasePath('docs'); return [ IDFIEld::new('ID')->onlyOnIndex(),TextFIEld::new('nomdocument','Titre'),datetiR_18_11845@eFIEld::new('created_at','Date de création'),TextFIEld::new('filedocument','document pdf') ->hIDeOnIndex() ->setFormType(fileType::class,[ 'consTraints' => [ new file([ 'maxSize' => '1024k','mimeTypes' => [ 'application/pdf','application/x-pdf',],'mimeTypesmessage' => 'Veuillez télécharger un document pdf valIDe',]) ],]),]; } public function configureActions(Actions $actions): Actions { return $actions ->add(Crud::PAGE_INDEX,Action::DETAIL); } }

我不知道如何在 Easy admin 中实现相同的配置。 Look Here 这是我从 Easyadmin 表创建文档时发生的情况。 谢谢。@H_772_3@

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!@H_772_3@

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。@H_772_3@

小编邮箱:dio#foxmail.com (将#修改为@)@H_772_3@

大佬总结

以上是大佬教程为你收集整理的PDF 文档创建 EasyAdmin symfony 5全部内容,希望文章能够帮你解决PDF 文档创建 EasyAdmin symfony 5所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。