74,212 questions
0
votes
0
answers
55
views
How to install league/csv bundle with Doctrine v3.3 on Symfony?
I am having a problem today installing the league/csv bundle (v9.27) on my Symfony (v7.2) project with doctrine/orm (v3.3)! When I run command php require league/csv, I get this message:
Your ...
2
votes
1
answer
106
views
Using macros with dynamic name using dot operator does not work
While upgrading twig v1.30 to v3.22.0 i encountered some problem using macros from an external file and calling them by using a variable value as dynamic name.
Given the twig file with the macros:
{# ...
-1
votes
1
answer
67
views
How to require login for a custom controller?
we are implemented a custom controller for one webspace of our sulu 2.6 installation. It requires login against our SSO, but the problem is, that the result is cached.
We have 4 Webspaces, just one ...
2
votes
1
answer
57
views
Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works)
Symfony/Doctrine: PostgreSQL Migration Issue – Undefined column error only in HTTP Kernel (CLI works)
I'm working on a Symfony 7.3 project running on PHP 8.2. I recently migrated the database from ...
Advice
0
votes
3
replies
78
views
Symfony monolog add additional info to all logs
I need to add trackability information for all logs.
E.g. logged in user and route parameters (entity ID)
Right now I have this code:
use Monolog\Processor\ProcessorInterface;
class RequestProcessor ...
0
votes
2
answers
56
views
Symfony UX LiveComponent with collection
I'm using a LiveComponent to access a form with a OneToMany collection.
Adding an item works perfectly, but when I delete an item, the entire collection is deleted.
The code is below.
->add('...
-1
votes
0
answers
37
views
Cannot import js package installed with importmap in symfony 6
i've installed swiper js with importmap:require swiper in symfony. it download a umd version of the package in the vendor/
Note: i use it in a stimulus controller
We cannot import Swiper from "...
0
votes
0
answers
75
views
Symfony UX Live Components - debounce filter on `data-model` with `data-action` attribute
I have a menu that is using Live Components that shows, loads more, and filters through a list of brands. It shows a list of brands with checkbox for each, that acts as a filtering option on the page. ...
0
votes
1
answer
63
views
POST search on API-Platform
I’m trying to create a getCollection route using POST with API Platform.
The idea is to perform a search that takes a JSON payload to handle search conditions first, and later manage relations, ...
2
votes
1
answer
104
views
Show several markers on a map with Symfony UX Map
I would like to have multiple markers on the same map with Symfony and UX Map!
I've read the documentation but can't find the solution there!
At the moment, I can get all the markers but on different ...
2
votes
0
answers
45
views
Symfony 6 - EasyAdmin - Custom form type canvas
I use Symfony 6 with EasyAdmin,
I've been trying for several hours to understand how form types work in Symfony, and more specifically how to set up a custom form field, but I can't find a simple, ...
2
votes
1
answer
127
views
How I can direct an event from a specific transport to a specific bus?
In my symfony project I have this configuration upon messenger.yaml:
framework:
messenger:
transports:
async: '%env(MESSENGER_TRANSPORT_DSN)%'
failed: 'doctrine://...
1
vote
1
answer
79
views
RememberMe doesn't work correctly with basic FormLogin
Using Symfony 7.3, I have this basic security.yaml:
form_login:
login_path: app_login
check_path: app_login
enable_csrf: true
success_handler: ...
2
votes
1
answer
173
views
Why does doctrine/doctrine-bundle cause errors in my symfony / composer project after upgrade?
When trying to do a "composer upgrade", it fails in "@auto-scripts" when reaching doctrine/doctrine-bundle.
The error is:
Executing script cache:clear [KO]
[KO]
Script cache:clear ...
0
votes
0
answers
81
views
Symfony UX LiveComponent file upload works only on first request
I’m having trouble with file uploads in Symfony UX LiveComponent.
I’m using Symfony 7.2, Symfony UX 2.x, and PHP 8.2.
The problem
I have a LiveComponent form that includes a file upload field.
On the ...
-1
votes
1
answer
88
views
Is it correct to use a UriVariable configuration via New Link for a Post Operation?
In the API Platform documentation about subresources, this configuration example is given for a GetCollection operation. And it works perfectly.
#[ApiResource(
uriTemplate: '/companies/{companyId}/...
1
vote
2
answers
139
views
Typed property App\Entity\X:X must not be accessed before initialization
I'm trying to upgrade my Symfony from 5.4 to 6.4 and PHP from 7.4 to 8.4. I almost did all changes but I'm currently blocked on this exception :
Typed property App\Entity\AppRole::$uniqid must not be ...
2
votes
0
answers
92
views
Doctrine ORM: Transaction commit fails after rollback in batch loop (Symfony 5.4, PHP 7.4)
I'm running a batch process in Symfony 5.4.48 (PHP 7.4.30, Doctrine ORM 2.20.3) where I need to handle database transactions per iteration. If a business condition fails, I want to rollback the ...
2
votes
1
answer
309
views
Why do my POST operations on a subresource update the same entry instead of creating new ones?
I am unable to get subresource POST operations working as expected in API Platform 4.1 with subresources; top-level resources work fine.
Expected: new subresources can be created as needed. Actual: ...
0
votes
0
answers
63
views
Why Upon failure SQS does not place the failed message upon DLQ?
I am running this worker:
php -d memory_limit=-1 bin/console messenger:consume sqs_channel_manager -vv
And worker fails:
14:29:32 INFO [messenger] Received message App\Domain\Event\ChannelManager\...
-1
votes
2
answers
70
views
Why retry cound does not increase upon exception thrown?
In Symfony I use a custom Serializer upon a transport:
framework:
messenger:
transports:
async: '%env(MESSENGER_TRANSPORT_DSN)%'
failed: 'doctrine://default?...
1
vote
1
answer
64
views
Is it possible to override the ID generation strategy defined in Doctrine Translatable AbstractPersonalTranslation?
I need some help regarding the usage of Doctrine Translatable (from Doctrine Extensions)
Context
I use Doctrine Translatable to translate an entity, and my use-case follows closely this example from ...
0
votes
1
answer
72
views
How can I disable ssl upon sqs on localstack?
Upon a symfony app I try to use localstack for local sqs:
services:
php:
container_name: php
build:
context: ./php
args:
TIMEZONE: ${...
0
votes
0
answers
71
views
Symfony app crashes during Xdebug session at EntityManager proxy, but manual evaluation works
I'm experiencing a strange debugging issue with my Symfony web application where Xdebug causes a crash, but manually evaluating the same code works fine.
Problem Description
When debugging my Symfony ...
1
vote
1
answer
68
views
Symfony 7 EasyAdmin 4: i'm try to show "yield Field\Field::new('status', 'Status')" in edit page with another class for this status
I have statuses in order(src/Entity/Order.php) (like 0,1,2,...). And i want to show this statuses like 'Created', 'Processed', 'Completed',...
I added class for list of order statuses:
namespace App\...
0
votes
1
answer
37
views
Symfony serialize Crawler Object for unit testing
I am using Crawler class from namespace Symfony\Component\DomCrawler\Crawler.
I want to unit test a method that is processing a Crawler object. For this purpose the parameter is a Crawler object, like
...
0
votes
1
answer
52
views
LexikJWTAuthenticationBundle subscriber event wont trigg?
is anyone comfortable with the Lexik bundle?
I created a subscriber based on the AuthenticationSuccessEvent, but when I log in, it doesn’t go through my event, and I don’t understand why.
providers:
...
0
votes
1
answer
60
views
WebProfiler still enabled in my Application Tests in Symony
Using Symfony 7.3, I noticed when I have an error in my Application tests, the HTML returned contains the WebProfiler, I see all the CSS / JS / Html from WebProfiler and it makes it hard to read.
I ...
0
votes
1
answer
42
views
Symfony Doctrine
I try execute this query to postgres - SELECT cn FROM App\Entity\User cn WHERE cn.path && ARRAY[1,2], but the query fails !
Error: Expected =, <, <=, <>, >, >=, !=, got '&...
0
votes
1
answer
40
views
Symfony UX Live Components: "Expected string, null given"
I'm using Symfony UX Live Components to edit an NtExam. I get this error when editing the form:
Expected argument of type "string", "null" given at property path
"exam_title&...
-3
votes
1
answer
231
views
autoformat with CS Fixer exited with non-zero code [closed]
I'm trying to set up PHP Coding Standards Fixer with PhpStorm but when I run the code auto formatter (Ctrl Alt L) I get an error:
PHP External Formatter: Process exited with non-zero code
Clicking ...
0
votes
1
answer
87
views
How to upload file in Symfony LiveComponent with other form data?
So, as per the docs, this is how we upload a file in Symfony Live components.
If we have to upload a file along with other input, how to do it?
Code from docs:
<p>
<input type="file&...
1
vote
1
answer
63
views
Add dynamically fields to a CollectionType in Symfony
I have this array structure:
{
pricing: {
type: {
name: "pricing.type",
type: "string",
format: null,
required: false,
options: [],
type: '...
1
vote
2
answers
264
views
Symfony in Docker: %env(csv:...)% makes framework.trusted_headers crash with “got array” error
When using Symfony inside a container, %env(csv:...)% seems to break when populating a config option that expects an array. For example, in config/packages/framework.yaml:
# see https://symfony.com/...
1
vote
1
answer
199
views
Api Platform generate non-required fields for id (and others)
I am using API Platform / Symfony (latest version) to manage my API.
Then, I use the @rtk-query/codegen-openapi library to generate my TypeScript typings.
The problem is that many fields are marked as ...
0
votes
0
answers
196
views
How to refresh a Live component manually?
I'm working with Symfony Live Components and noticed an issue when switching between child components.
My parent template looks like this:
{% if step == 1 %}
<twig:ChildComponent1 />
{% ...
1
vote
1
answer
147
views
How can I add one "subform" for each day within a range
I'm currently developing a small CRM for a hotel, and I'm hitting a problem with dynamic forms. On the RoomBooking form, the user is invited to select a start date and an end date for the booking. At ...
0
votes
0
answers
75
views
Loading subcollection of relation entity records in Doctrine
I stumbled upon a problem I would never though I can have, since its trivial to solve using SQL, but since I want to keep things code-oriented, I've tried DQL, QueryBuUildder and Repository approach. ...
0
votes
1
answer
105
views
Keycloak + Symfony (KnpU OAuth2Client) users getting logged out after ~30–60 minutes despite long session settings
I'm integrating Keycloak with a Symfony app using knpuniversity/oauth2-client-bundle and a custom authenticator. The flow works fine, but my users (and myself) are getting logged out after about 30–60 ...
0
votes
1
answer
87
views
Missing data after self-update of a custom Symfony sub Type
In Symfony, I'm trying to create a Type based on EntityType. The idea is to have an EntityType field whose options are loaded via AJAX (using the Selectize library). However, once an option has been ...
0
votes
0
answers
117
views
Formtype on Symfony 7.3 that doesn't render
Before with my Symfony project with the version 6.1, I could do it.
{{ form_start(form, {'attr': {'id': 'form-add-meeting'}}) }}
{{ form_widget(form) }}
<label for="">Date ...
0
votes
1
answer
84
views
How to create a modular project hierarchy? [closed]
How do I build my application hierarchy modular, having separated modules which are more plug n' play-ish.
I would like to have a structure like this:
- assets
- bin
- config
- migrations
- public
- ...
1
vote
2
answers
195
views
How to use the array key as part of the hydrated value with the Symfony Serializer?
I have a json with collections of data like these :
{
"item_a": {
"name": "Item A",
"description": "...",
},
"item_b&...
0
votes
0
answers
52
views
How to add a date query parameter for a resource not based on entity?
I have a GET endpoint that is not related to any entity. The endpoint returns the European VAT rate for a given date. I need to add a parameter named date with the type date (which should return a \...
2
votes
0
answers
88
views
Symfony debugbar on a production server [duplicate]
I am trying to activate my debugbar on my production server, but restrict it by IP, so it would only be available to me (and the others developers).
Nothing I tried worked, here's the list of what I ...
0
votes
1
answer
52
views
translation:extract is not working in forms
Regarding this form:
<?php
// src/Form/ContacteType.php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\...
0
votes
0
answers
126
views
Custom bundle no services found in debug:container
I need to add new features to a custom Symfony bundle that my colleague had previously developed. To work with this bundle, I installed it in the Symfony base_app via composer. There was an error ...
0
votes
1
answer
55
views
503 error on second request to specific DQL route in production
I'm working on a project using Symfony 5.4 and PHP 7.4. Everything works correctly in both dev and prod environments, except for one route that performs a series of DQL queries on an entity.
In ...
1
vote
1
answer
85
views
Flash doesn't show up on app_default
I try to use an app_flash on my symfony app, it work everywhere but when I try to display a flash on my app_default it doesn't work. I tried to dump but it's empty like nothing is send.
I have a ...
1
vote
2
answers
100
views
Doctrine migration ignores UniqueConstraint
Tech stack: Symfony 7.3 + Doctrine 2 + PostgreSQL.
I would like to create unique index for two columns - app_id and user_id - for user_mobile_apps table.
Entity:
declare(strict_types=1);
namespace ...