Questions tagged [symfony4]

Symfony is a PHP framework developed by SensioLabs. Symfony 4 was released in November 2017.

Symfony is a PHP web framework first released in July 2011 and was created by SensioLabs. Symfony 4 was released in November 2017. The latest LTS is 4.4.8 released in November 2019 and has support until 2022.

Differences from Symfony 3

  • Symfony Flex automates many of the tasks that previously had to be done manually - it’s based on Symfony Recipes, which are a set of automated instructions.
  • Version 4 also recommends a bundle-less setup, e.g. putting many of the source files directly in /src instead of something like /src/AppBundle.
  • Installing using the Symfony skeleton will create a relative small version of the app. Additional packages need to be added. A more fully-featured version (more similar to the »Symfony Standard Edition« in Symfony 3) is available with the Symfony Demo Application.
  • Minimum PHP 7.1.3

Documentation / Resources

  • Overview: Documentation for current version.
  • Flex: New way to manage Symfony apps.
  • Best Practices: Best practices for developing web apps, esp. the ones using the full-stack Symfony framework.
  • Symfony Recipes Server: Includes official and community recipes.
3929 questions
1
vote
1 answer

HWIOAuthBundle custom user provider will not login user

I'm using HWIOAuthBundle with Symfony 4.1. My custom user provider gets called and returns a valid user, however the user is not logged in after the redirect. The web profiler shows: logged in as anon; anonymous token; firewall main I've simplified…
Coder1
  • 12,741
  • 13
  • 52
  • 74
1
vote
0 answers

Innerjoin with orderBy or using groupBy on other table

I'm using Symfony 4 and Doctrine, and I have one problem with DQL query, I have two tables with Type and Product relationships, one Type can have many Products and one Product can have one Type. How do I write a query that will return the records to…
jonadf
  • 21
  • 3
1
vote
1 answer

Symfony4: How can I access the path to the cache directory from a service

I want to access the path to the cache directory from a service to save some temporary files there. In Symfony2 that was not problem, but I am stuck how to achieve that in Symfony4. If I access the ParameterBag I find the value of the log directory,…
Calamity Jane
  • 1,557
  • 4
  • 21
  • 41
1
vote
1 answer

Symfony4 - How to pass a TokenStorageInterface to an EntityListener?

I'm currently working on a project created with api-platform and using Symfony4. My goal is to be able to use a TokenStorage inside of an EntityListener in order to know the identity of my user. Unfortunately, I can't find a way to pass a…
Axelle G
  • 11
  • 3
1
vote
1 answer

Symfony4. ParamConverter annotation conflicts injecting a service by autowire

When I try to use @ParamConverter annotation in a Controller action, I get an error "Cannot resolve argument $company of \"App\\Controller\\ProfileController::top()\": Cannot autowire service \".service_locator.0CrkHeS\": it references class…
Phantom
  • 332
  • 3
  • 10
1
vote
1 answer

What’s the proper way to handle an AJAX call behind Symfony 4 firewall?

I need to send AJAX requests to parts of my website where my user is authenticated. Unfortunately, Symfony 4 rejects those requests (and sends them to login page) as it doesn’t detect it as authenticated access to my controller/route. How do you…
Miles M.
  • 3,799
  • 9
  • 53
  • 94
1
vote
1 answer

proper way to test a service in Symfony 4, with database access

What would be the proper way to test a service in Symfony 4, which also accesses the database? I am new in Symfony4 (before I developed for Symfony2) and I want to write my first test for a Service. This service is writing via Entities / Doctrine /…
Calamity Jane
  • 1,557
  • 4
  • 21
  • 41
1
vote
2 answers

Imports are highlighted like the packages do not exist (Symfony 4)

I'm working on a Symfony 4 project with PhpStorm 2018.1 It has become common for me to see the use declarations highlighted as if they haven't been installed with composer. The class belongs to a package which is not directly required in your …
Coder1
  • 12,741
  • 13
  • 52
  • 74
1
vote
1 answer

Symfony service destructor called multiple times

I've been playing with Symfony 4 for a while now and I've created a twig extension for one of my webpages recently, which is responsible for translating any given string based on data in database. Unfortunately, I've faced with a weird problem which…
Dawid Zbiński
  • 3,970
  • 7
  • 36
  • 63
1
vote
3 answers

Symfony4: inject service into controller __construct (constructor)

I am having trouble accessing an injected service in the constructor of one of my controllers. Per http://symfony.com/doc/current/service_container/injection_types.html I believe I have done the injection correctly, however when I try to load a view…
Brian Brownton
  • 1,133
  • 12
  • 29
1
vote
1 answer

Symfony 4 - Don't load DataFixtures in production

In production, DoctrineFixturesBundle isn't present, so when Symfony tries to register my DataFixtures classes it will throw an error. This is what I've tried, but it seems like Symfony is ignoring services_prod.yaml, or it's not correctly…
sharif9876
  • 610
  • 4
  • 16
1
vote
0 answers

Authentication event not being called

I have the following simple class:
Alex.Barylski
  • 2,281
  • 3
  • 37
  • 57
1
vote
0 answers

symfony flex with private recipes

What's the proper way to setup a flex recipe (private or public repository) for a package (private repository)? What I tried so far Got a private repository on bitbucket with a package. Got a private repository on github with recipes. Configured…
Leggy7
  • 435
  • 7
  • 20
1
vote
1 answer

KnpPaginator not works on joined tables

I'm trying to get two tables joined and get a sorted result set from KnpPaginator. Here is my code. View
vimuth
  • 2,928
  • 13
  • 43
  • 73
1
vote
1 answer

How to override bundle templates and controllers (FOSUserBundle) without using bundle inheritance

In my Symfony 2.8 based project I use FOSUserBundle and extended it with a custom MyUserBundle using bundle inheritance. When trying to update FOSUserBundle from 2.0.2 to 2.1.2 I came across several problems. Since Bundle inheritance is deprecated…
Andrei Herford
  • 15,149
  • 16
  • 73
  • 171
1 2 3
99
100
{{ knp_pagination_sortable(pagination, 'Id', 'c.id') }}