Requested developments

Creation of a document template with access to variables to retrieve the title of a song, its external link, its link to the audio as well as its SECLI rating from the ProgrammeDeChant variable
Hello, is it possible to access the various elements that make up the program of songs for a celebration in order to indicate the progress of all the songs recorded during the celebration (being able to visualize the name, the drive file for the score and the sound). I have currently created a document template where I can indicate whether or not there is an informed singing program for a celebration. I would like to edit the following information in my document (the place of the song, the title of the song, SECLI code, external link and link to the audio) for each of the songs recorded during the celebration. I tried with the following code: {% if messe.singing program%} <div><strong>List of songs:</strong></div> <ul> {% for singing in messe.Programmedechant.getChants ()%} <li>TITLE {{chant.title}} Score {{chant.external link}} Score {{chant.title}}</li> {% endfor%</ul>} {% else%} <div><strong>No chants</strong></div> {% endif%} But I have the following error: calling 'title property on a “App\ Entity\ ChantProgramme” object is not allowed in “__string_template__...” Can you tell me how I can access the properties of the various songs in the program? My goal is to be able to generate a document listing this information in order to distribute it to the singers and musicians involved in the celebration. Thanks in advance.
0
Inserting a QR code into a document template
I would like the Twig QR Code generation function to be operational. Indeed, when I use it in the code below for example: <div class="titreSep" align="center">CATECHISM MEMBERSHIP</div> <table width="100%" border="0" style="font-family:Arial, Helvetica, sans-serif;"> <tr> <td style="text-align: left; vertical-align: top; width: 70%;"> <p>Membership fee: €35</p> <p>Check payable to: AD34 Jean Baptiste du ?$#@$</p></td> <td style="text-align: right; vertical-align: middle; width: 30%;"> <img src="{{ qr_code_url(' https://example.com/paiement/cotisation ') }}" alt="QR Code" style="width: 100px; height: 100px;"/></td> </tr> </table> I am getting the following error message: An error occurred in creating the file, check your model: Typed property App\ Service\ DocumentsPDFDisplayService: :$flashBag must not be accessed before initialization When asking Gemini, Google's AI, what to do, he gives me the following answer, suggesting that the problem is related to the PHP code on the server: ****************************************************************************** This error is not related to the HTML modification you made, but rather to the way your server-side code (probably in PHP with the Symfony framework) manages one of its classes. The error “Typed Property App\ Service\ DocumentsPDFDisplayService: :$flashbag must not be accessed before initialization” means that: You have a service class called DocumentsPDFDisplayService. This class has a property (internal variable) named $flashBag. This property has been declared with a “type” (e.g. private flashBagInterface $flashBag;). The code tries to use this $flashBag property before it has been assigned a value. In PHP, a typed property must have a default value or be initialized in the class constructor. Cause of the error The line of code that is generating the error is probably in your DocumentsPdfDisplayService.php file, not in your HTML file. Modifying the HTML code, such as adding the qr_code_url () function, most likely triggered this service which, for some unknown reason, is not properly receiving its $flashBag dependency before being used. Solution Since the error occurs in the DocumentsPDFDisplayService service, you need to edit this file. There are two ways to solve this problem: Option 1: Initialize the property in the constructor (Recommended) It is the cleanest and most common solution. You need to make sure that the $flashBag is properly injected and assigned to the property when creating the class. In your src/Service/DocumentsPdfDisplayService.php file, you should find something that looks like this: PHP //File: DocumentsPdfDisplayService.php namespace App\ Service; Use... ; class DocumentsPDFDisplayService { private $flashBag; //or private flashBagInterface $flashBag; public function __construct (flashBagInterface $flashBag) { $this->flashbag = $flashBag; } //... the rest of your code } If the $flashBag is injected via the constructor, make sure it is properly assigned. Option 2: Make the property “nullable” If the $flashBag is not always needed for the service and it may be null, you can declare it as “nullable” and give it a default value. PHP //File: DocumentsPdfDisplayService.php namespace App\ Service; use Symfony\ Component\ HttpFoundation\ Session\ Session\ Flash\ FlashBagInterface; class DocumentsPDFDisplayService { //Make the property nullable and declare it with a null default value private? flashbagInterface $flashBag = null; //... the rest of your code } Note: Do not adjust your HTML file. The problem is in your PHP code. The Typed Property error is a clear indicator that an object is being called before it is successfully initialized. If you have access to your logs, it can give you more information. **************************************************************************** What do you think, could you, with these explanations, make this Twig function efficient? Thank you so much for your help
4
Load More