Questions tagged [symfony]

The term "Symfony" encompasses a dual meaning: it signifies both a web application PHP framework and a collection of underlying components that form the foundation of this framework. For inquiries related to currently supported major versions (4.x, 5.x, 6.x, and 7.x) of Symfony, you may employ this tag. Alternatively, if you wish to address a specific version, kindly include the corresponding tag. It is important to note though that this particular tag should not be utilized for queries regarding Symfony 1.x. In such cases, please make use of the Symfony1 tag instead.

Unable to apply .png image using the content property in a Symfony project

I have a png image located in src/AppBundle/Resources/public/img To set the png image using the css content property, I used this code: content: url(../../public/assets/img/optional-checked.png); However, I encountered an error: GET http://127.0.0.1:80 ...

User access is managed through websockets

Currently, I am integrating Websockets into my php project using Ratchet and Symfony. Upon user login, they are automatically connected to a specific channel within the websocket connection. Messages can be pushed to the channel and displayed on the client ...

Navigating the world of web development can be challenging, especially when trying to

I recently came across a useful tutorial on integrating Symfony with Vue.js, which can be found here: While the tutorial was helpful, I am now looking to implement a specific example from the Vue.js documentation at https://v2.vuejs.org/v2/examples/ into ...

Tips for retrieving an uploaded file in Symfony 2

I am facing an issue with my Document Entity where I want the users of the website to be able to download the uploaded files. I attempted using a downloadAction in my DocumentController but encountered some errors. Below is my Document entity : <?php ...

Encountering difficulties with starting the API Platform

Exploring the Platform API framework with Symfony and following their documentation to set up a demo API. Link to API Platform Framework Documentation Everything seems to be working fine, but when I start the server, there is no UI visible. Instead, my ...

Using JQuery AJAX to pass CSRF in a Symfony2 form

I have been working on a comments box that utilizes JQuery AJAX call to save the comment. JQuery Implementation Below is the code snippet for using JQuery (which works flawlessly): $(".post-comment").click(function() { var $form = $(this).closest("f ...

Utilizing PHPMailer without a Google Mail account

I'm curious about testing local mail sending with PHPMailer in the Symfony3 framework. Most of the online guides only cover configurations for Gmail accounts. Is there a way to send test emails locally without setting up an external server? ...

Webpack Plugin System for Building Web Applications

In the context of my project, I am currently working on a product utilizing Symfony for the back-end and react/react-router for the front-end, all connected via Webpack. My plan is to structure my app into different "extensions", which would consist of a " ...

Symfony ElasticaBundle event listener and method for building queries

I want to upload leads in elastic only when their status is approved. Here is my mapping: persistence: driver: orm model: ArtelProfileBundleEntityLead provider: query_builder_method: createIsActiveQueryBuilder listener: ~ fi ...

Using Twig: Transfer the content of a textfield as a parameter in the routing

I have a task of redirecting to another page while passing along the value from a textfield. Here is my current code: {% extends "base.html.twig" %} {% block body %} <button onclick="host()">Host the session</button> <button onclic ...

Symfony allows for unique field validation for one-to-many relationships

My Request entity contains multiple Interventions structured as follows: Request.php /** * @ORM\OneToMany(targetEntity=Intervention::class, mappedBy="request") * @Assert\Count(min=1, max=3) * @Assert\Valid ...

What is the correct method for embedding a javascript variable into a Twig path?

I am looking to include a variable declared in JavaScript into the path for redirecting my page. Here is my code: var id = $(this).attr('data-id'); windows.location = {{ path("mylink", {id: id}) }}; Unfortunately, I am getting an error when trying to ...

Symfony2 form supporting number inputs greater than 2 billion

I am in need of assistance with my Symfony form's number input limitation. Currently, I am unable to enter extremely large numbers into the form as it is restricted to a maximum value of approximately 2 billion. Within my entity "Transaction," I have ...

Invoking Ajax to communicate with a Symfony controller

Having some trouble calling a method using ajax. The ajax connection is successful and no error messages are appearing. Here's the JS code: $("[id^=changeStatus]").each(function(){ $(this).on("click", function(){ const id = $(th ...

Securing Confidential Images in Symfony2

Currently facing an issue with my Symfony setup. Users in my app can upload images to the server, which are stored in /web/uploads/images directory. My goal is to make these images visible only to logged-in users. I've attempted to tweak the security conf ...

Retrieve information about associated entities

I have two entities called Classe and Student. These entities are related in a OneToMany relationship, where one class can have multiple students. I am currently designing a page where I need to display the names of all the students associated with a selec ...

Creating a new object within a class in Symfony using PHP: How can I instantiate an object from another class?

I created a PHP Symfony project to enhance my understanding of the framework. However, I have encountered a problem where I need to access another Controller within my current Controller in order to utilize its methods. In simpler terms: How can I instant ...

Leveraging JS Variables within Twig Template

I am trying to incorporate a JavaScript variable into Twig. Despite attempting to implement the solution mentioned here, my code below does not render the map properly. If I remove the part between "var polylineCoordinates" and "polyline.setMap(map);", th ...

Encryption and encoding of Symfony2 source code

Our team is working on a project using the Symfony2 framework and we plan to sell the application to clients. To protect our source code from being accessed by customers, we are exploring options for encrypting it. However, we have encountered difficulties ...

Issue encountered when compiling Vue 3 with TypeScript and Webpack Encore: Vue Router's $route is missing

I've been grappling with setting up vue-router's $route in my shims.vue.d.ts file to avoid getting an error on the this scope. Whenever I try to access this.$route.params.paymentId, I keep receiving a type error: TS2339: Property '$route' does not exist on ...

Symfony 2 and the power of asynchronous requests!

I'm facing a major issue because I am unable to make an AJAX request in Symfony. Below is some code snippet from my template: $( document ).ready(function() { $( ".data" ).change(change_selected); }); function change_selected(){ $.ajax({ ...

Guide for integrating the logic of editAction into showAction within Symfony 2 Doctrine generated CRUD

I have a Symfony 2 project where I've used Doctrine to generate CRUD's for certain entities in my database. Specifically, I have entities named TariffMc and TariffMcServiceMcRelation. A single TariffMc entity can be associated with multiple TariffMcService ...

Updating the admin login page for sonatauser

I am trying to modify the page admin login in sonatauser, located at sonataproject/userbundle/admin/Resources/views/admin/security/login.html.twig. However, I am facing difficulty as the file extends the base template. Does anyone have a solution for thi ...

Tips for uploading images in Sylius

After successfully downloading and installing the Sylius Symfony project, I encountered an issue when trying to upload an image file. Specifically, the problem arose when attempting to add an image in /admin => Products => (after selecting one) Edit produ ...

Symfony2 Query Builder for selecting data where the total quantity of children is greater than zero

In my quest to gather a result set of orders with associated children (OrderPayments), I am specifically looking for orders where the total sum of OrderPayments exceeds zero. Despite my efforts, I have encountered an issue while executing the code. The er ...

Issue with Symfony: form fields not being submitted properly after an ajax call

I have a form that includes 3 select boxes. The options in the second select box depend on the selection made in the first select box, and the options in the third select box depend on the selection made in the second select box. I am using ajax to dynamic ...

Tips for building assets on Heroku using Webpack Encore?

After adding the heroku/nodejs buildpack to my Symfony heroku app, I successfully installed my yarn dependencies. Despite this, I am encountering difficulty when trying to run $ yarn run encore production Each time I attempt to run the command, I receiv ...

The Symfony2 AssertExpression annotation does not allow the use of Constants

Typically, I make use of Constants in all annotation-based contexts such as annotations, route and assert annotations. However, when it comes to Assert\Expression, an error is thrown stating Variable "EntityInterface" is not valid around position 26.. ...

What is preventing the InteractiveLoginEvent from being triggered in Symfony's new 5.1 security system?

Having trouble triggering the InteractiveLoginEvent with the new Symfony 5.1 security system. Despite following the configuration provided in the official documentation (here and here), my system worked flawlessly with the previous security setup. Here i ...

Capturing information from a form containing various elements for storage

After following the instructions provided in https://symfony.com/doc/current/form/embedded.html, I encountered an issue when trying to submit a form containing three entities - Patient, PatientSample, and PatientOrder. The error message stating that patien ...

Prevent header from being displayed in XML response in Symfony 2

I am currently working on generating an xml document using Symfony. The generation process is successful and I am returning the document using a Twig template named sitemap.xml.twig as shown below: <?xml version="1.0" encoding="UTF-8"?> <urlset x ...

Diving into Symfony2's subform features

I am attempting to embed one form within another form without creating a class specifically for the forms. Here is my current approach: $form = $this ->buildForm('UserAlert', $alert) ->add('Alert', 'entity', array('class' => 'Bla ...

Embedding services into Entities: Verifying the presence of an image file

Currently, I am working with PHP and the Doctrine ORM. The situation at hand involves a product table that has an image field. My goal is to create an event that verifies whether an image exists in my assets cloud storage (specifically Amazon S3). If the f ...

The perfect combination: Symfony2 and AngularJS working together

Currently, I have been working on a web app that utilizes Symfony2 and recently integrated AngularJS. Within this app, there is an input field where users can filter products by name. The issue arises when it comes to querying the database in PHP and passi ...

Whenever I shop on Shopware 6, I can store my Affiliate/Campaign code in the session for easy access in

I am currently experiencing an issue on my Production System version 6.4.2.1, although I encountered the same problem on a newer version, 6.4.14. The issue arises when entering the shop for the first time with a query parameter URL such as https://shop/?a ...

Oh no, Symfony 2.6 is throwing a Doctrine ORMException: The EntityManager has been shut down

Currently, I am in the process of importing users from an excel file. To manage this task effectively, I have established an entity manager: $em = $this->getDoctrine()->getManager(); Here is a snippet of the loop I am using for this operation: .. ...

Using Symfony2 to inject Doctrine Dbal as a service in a constructor

Seeking help with passing a Doctrine dbal connection to my controller's constructor. I tried following the steps in this guide, but it's not working as expected: How do you access Doctrine DBAL in a Symfony2 service class? Below is the snippet ...

Is there a way to define a varying number of OR conditions in a Doctrine SQL Where clause?

Is there a way to dynamically generate a Doctrine ORM query that mimics the following SQL statement, considering that the number of values in the 'OR' clause may vary with each execution? SELECT * FROM table1 WHERE table1.group = 1 OR 2 OR 3 For in ...

unleashing the magic of AJAX: a guide to extracting

In my Symfony project, I am attempting to retrieve the content of an AJAX request in order to check the data using dump(). The purpose is to process this data and perform a SQL query. However, when I use dump() in my controller, there doesn't appear to be ...

Access Denied: Unauthorized token detected in Symfony 5.4

Running Symfony 5.4 in a development environment (docker) allows successful logins. However, attempting the same login via docker in production results in the following error message: {"message":"Invalid CSRF token."} The issue seems t ...

Troubleshooting: Symfony Entity Failing to Save in Database during Persist Operation

This code functions properly when used in controllers, but it encounters issues when injected into a command. public function execute(InputInterface $input, OutputInterface $output) { $em = $this->getDoctrine()->getManager(); try { $t ...

Symfony equivalent of Auth::attempt

Looking for a straightforward way to authenticate users in Symfony similar to Laravel's Auth::attempt(... method. My user entity already implements AdvancedUserInterface, and I've been reviewing the Symfony security documentation. I'm searc ...

A group of Symfony Messenger consumers working together efficiently

Is it feasible to have a shared pool of messenger consumers for the same queue? I attempted to utilize the Redis consumer= options, but to no avail. Perhaps a "pool" middleware could facilitate routing to particular transports? ...

Trouble running composer update in Symfony 2.2

Today, I've been facing an issue with updating my vendor packages in Symfony. The error message I received is as follows: PHP Fatal error: Class 'ComposerScriptPackageEvent' not found in phar:///var/bean/deploy/qa/2013-06-03/api/composer.phar/src/Compo ...

How do I save basic information to a MySQL database with JQuery/AJAX in Symfony?

I am currently trying to save a basic piece of data (the file title) within a div element into a MySQL database. Can anyone help me identify any errors in my code? Below is the script I am using: $( document ).ready(function() { $( "#store-button" ). ...

Does $this->forward lose track of the route requested by the user?

I need to direct admins to /admin and members to /member when they are logged in and try to access the home page (/). The controller function for this logic is shown below: public function indexAction() { if ($this->get('security.context&apos ...

The persistent struggle with Symfony2 DB2 doctrine: Creation of the database failed

When attempting to create my database structure in DB2 using Doctrine, I encountered the following response: >php app/console doctrine:database:create Could not create database "monng" for connection named default Notice: Undefined index: dbname Howev ...

Using Symfony2 to make an Ajax request in order to show a message based on a particular condition

As a novice in the realm of JavaScript and Ajax, I am struggling to find a way to display a message based on certain conditions. Let's consider a scenario where a user can adjust the quantity of a product they wish to purchase. While implementing thi ...

Mpdf does not support inline CSS rendering

I recently implemented Mpdf into my Symfony project using Composer. The installation process involved running the following command: composer require mpdf/mpdf Next, I included the Mpdf.php file in autoload.php. Here is an example of how to use Mpdf in ...

Are there any tutorials available for creating complex web applications using Symfony2?

I am embarking on developing a sophisticated web application using Symfony 2, which involves managing 20 different database entities with many-to-many relationships. Although I have programming experience, I am relatively new to Symfony and object-oriente ...

Can the default parameter values for routes be dynamically updated in Symfony2?

I am working on a Symfony2 controller where I have defined a route using annotations. For example: @Route("/{year}", name="show_list_for_user", defaults={ "year" = "2012" }) I am wondering if it is feasible to make the default year dynamic. Perhaps by re ...

Creating an Ajax search feature using Symfony and Jquery

Hey everyone, currently I am working on a Symfony project and I'm trying to implement a real-time search using AJAX. However, I've encountered an issue where the search is returning all data from the database instead of filtering based on my keyu ...

Customize your file input with Bootstrap 4 using bs-custom-file-input and create a Symfony 5 collection with dynamic upload fields

The issue of not having a label for the chosen filename in a bootstrap 4 upload field has been resolved using the plugin https://github.com/Johann-S/bs-custom-file-input You can utilize "bs-custom-file-input" to showcase the selected filename in the boots ...

Incorporate a new element into your webpage using an AJAX call in Symfony 3, all without

I am currently working on implementing Symfony forms within a modal using AJAX to prevent page reloading every time an add/remove or update action is submitted. However, I am not very familiar with AJAX and unsure how to proceed. Can anyone provide guidanc ...

Guide to fetching and returning data from AJAX using a function

In my JavaScript file, I have a function that retrieves a value asynchronously from the server: function retrieveValue(userId) { $.ajax({ type: "POST", url: "http://localhost/bghitn/web/app_dev.php/get_number_of_articles", data ...

Incorporate the Coreui admin bootstrap template into a Symfony project

I am currently working on implementing the CoreUi Admin Bootstrap template into my first Symfony project. However, I have encountered some issues. Firstly, the sidebar is not functioning properly and I am unable to minimize it. In addition, there seems t ...

Cookies are not being sent by Angular 2

Currently, I am working on a project that involves frontend development using angular 2 and backend with symfony as the API. However, I am facing an issue where I need to send the PHPSESSID when making a request to symfony, but it is not happening as expec ...

Encountering a 404 error with Symfony and React Router integration

Whenever I try to refresh the site on routes other than "/" I encounter a 404 error. My setup involves Symfony and React Router. I have tried adding priority to the route, but unfortunately, it doesn't seem to resolve the issue. The code snippet below s ...

"Transferring a JavaScript variable to Twig: A step-by-step guide for this specific scenario

When it comes to loading a CSS file based on the user's selected theme, I encountered an issue while trying to implement this in my Symfony application using Twig templates. The code worked flawlessly on a simple HTML page, but transferring it to a Twig te ...

Best practice for organizing a class in Symfony2

As a newcomer to Symfony2, I am curious about the recommended approach for handling certain tasks. In my application, there are numerous administrative actions that involve receiving form data and processing it. Typically, after processing is completed, t ...

Develop a dynamic progress bar with Symfony 2 Framework to display status updates as a task is being executed

Having conducted extensive research and testing, I find myself in a situation where posting this information request is my last resort. Despite numerous attempts, I have been unable to achieve the desired outcome. My goal with Symfony Framework v2.8 is ra ...

What is the best way to transfer the content from a tinyMCE textarea editor to an inner controller using Symfony3 and Ajax

I have two small rich text editors identified as #homepage and #thankyoupage. My goal is to submit the content of these TinyMCE text areas to a Symfony controller. Below is my front-end implementation: https://i.stack.imgur.com/TE1Ys.jpg Currently, I am ...

Symphony 5.0.* no longer includes the ArrayCache component

I'm encountering a problem that I can't seem to resolve. Ever since updating my dependencies, I've been facing an error related to the ArrayCache in Doctrine. An issue arises at ContainerBuilder.php line 1103: The class "DoctrineCommonCacheArr ...

Encountered an issue when attempting to save data to the database using an AJAX request in Symfony 3

i need to input text in a form and store it in my database as well as display it on my view using jQuery. here is the input form: <div class="panel rounded shadow"> <form method="post"> <textarea id="txt" class="form-control in ...

Uncovering the Service Constructor's Potential Argument List in Symfony2

I'm searching for a complete list of potential service constructor arguments such as @request, @service_container, etc. Can anyone point me in the right direction? ...

Unleashing the Potential of Your Symfony2 Project

I successfully developed a Symfony2 project using NetBeans 8.0.2 and XAMPP on my Windows PC. After that, I transferred all the project files to an Ubuntu server and executed a few commands: chmod -R 777 app/logs chmod -R 777 app/cache Following this, I pr ...

Is it possible to have nested associations within Shopware 6?

Within my EntityDefinition, there is an association: ... class ParentEntityDefinition extends EntityDefinition { ... protected function defineFields(): FieldCollection { return new FieldCollection([ (new OneToOn ...

Creating dynamic date fields in Symfony/Doctrine is a valuable skill to have. Here's a step-by

Managing a user database involves storing user information such as name, age, and address. However, one crucial field in the database is created_at, which records the registration time of the user. In traditional PHP code, this can be achieved using: INSE ...

Tips for validating an iFrame in a Symfony form input using a regex

When filling out a publishing form, users have the option to include one or multiple media items by simply copying and pasting <iframe> tags into the designated text fields. I am seeking a solution to ensure that only valid <iframe> tags are e ...

The PHP code functions properly when executed on the command line, however, troubleshooting

Currently, I am utilizing PHP client code with a Symfony dom-crawler that was added via composer. The code functions perfectly when executed from the command line; however, during debugging, it crashes and generates the error below: PHP Fatal error: Unca ...

Occasional Dysfunction of Symfony2 Serializer

This is the code snippet for my controller. It works perfectly most of the time and returns a well-structured JSON object. However, I've encountered an issue where it hangs on a particular line. The strange thing is that the problem doesn't seem to be rela ...

Protracted execution time in Symfony3 due to extended foreach loops

I have a file upload listener that uploads files, parses them, and saves the data to a database using Doctrine. Below is the script: <?php namespace AppBundle\EventListener; use CommonBundle\Entity\Classifiers; use Doctrine\Common& ...

Symfony 4 Forms: Enhancing User Experience with Prototypes

Recently, I've delved into Symfony 4 and encountered an issue with rendering a form featuring a ChoiceType Field with numeric choices. The goal is to allow the user to select a specific number of tags. Here's a snippet from my controller: class ...

Incorporating form fields for editing into Symfony 2's database

Can someone help me troubleshoot my issue with Symfony2? I'm new to this framework and struggling with a problem in my twig file. I have a form where I enter a test name and the names of its categories, along with a color for each category. However, w ...

Tips for effectively handling roles within a Symfony2 application

In my web application, there are 5 levels of users: Administrator Organisation Head Local Company Head Teacher Parents Students Each user will have a different landing page with varying tabs and features. I am considering creating one Entity for all us ...