the Symfony 3.x specific tag. Use it in addition to the symfony3 tag if your question is specific to any version of Symfony 3.
Questions tagged [symfony3.x]
174 questions
1
vote
0 answers
Access deny all controllers except few. Symfony 3
How to deny access to all controllers except some?
I have roles: ROLE_SUPER_ADMIN, ROLE_ADMIN, ROLE_MANAGER.
If I use annotations, then everything is fine. The index method is available to the manager, the ROLE_MANAGER in the method overrides the…

Алексей Ташматов
- 11
- 1
1
vote
1 answer
ServiceNotFoundException: dependency on a non-existent service "twig"
I have this error:
The service "fos_ck_editor.renderer" has a dependency on a non-existent service "twig".
My framework config in app/config/config.yml:
framework:
#esi: ~
#translator: { fallbacks: ['%locale%'] }
secret: '%secret%'
…

maria d.xx
- 11
- 1
1
vote
0 answers
Default value in dropdown
I have this code in the form:
$formShipping->add('shippingType', EntityType::class, array('mapped' => false, 'required' => true,'placeholder' => 'Select a shipping method', 'label' => 'Shipping Method', 'class' => 'BackendBundle\Entity\Shipping',…

juanitourquiza
- 2,097
- 1
- 30
- 52
1
vote
1 answer
Symfony3 - The association refers to the owning side field which does not exist with ManyToMany and fields table
i'm trying to make a manyToMany relationship with more attributes than the ids, so I need two OneToMany relationships and two ManytoOne relationships having three tables/entities.
I have Product entity, Client entity and ProductClient entity:
class…

Manuel González Burgueño
- 53
- 1
- 3
1
vote
1 answer
How to prevent rebuilding of Symfony cache in each request in test environment
I have Symfony 3.3/3.4 and since at some time my functional tests have started to work very slowly. Tests which took 10 minutes started to take 1 hour and more.
We use these packages:
"symfony/symfony": "^3.4",
"doctrine/orm":…

sane4ek-2
- 21
- 1
1
vote
0 answers
bootstrap.php.cache in a Symfony 3.4 application
I am looking to confirm how my app*.php files should be configured with regards to the bootstrap.php.cache file.
I have read some conflicting advice on how to treat this file in Symfony 3.0 and above, namely…

crmpicco
- 16,605
- 26
- 134
- 210
1
vote
2 answers
Fetch distinct rows without doubled property values on MySql DB with Symfony 3.4 and Doctrine
In a Symfony 3.4 Application I have an Entity with 4 properties plus the id.
It is managed by doctrine on a mySql DB.
Say the properties where named p1, p2, p3 and q.
An example DB table could be like this:
id p1 p2 p3 q
------------------
1 x…

user3440145
- 793
- 10
- 34
1
vote
2 answers
$this->getContainer() is returning null in Symfony 3.x for Command
I am working on a project. I have some custom validator which is basically checking some data integrity in my database before saving any new record. So for that check, I need to access the Doctrine entity manager. So below is my…

William Francis Gomes
- 561
- 1
- 7
- 29
1
vote
1 answer
orphanRemoval=true removes all related entities
I have a strange problem with a relation between two entities:
One Joboffer can have many jobofferLocations, while Many jobOfferlocations only have one joboffer:
class Joboffer
{
/**
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
…

sneaky
- 439
- 1
- 6
- 18
1
vote
2 answers
Symfony 3.2 - HTTP 204 when echoing file_get_contents() for an image created with imagejpeg()
I created an image using the imagejpeg() function within my entity class
$imageSize = $this->_getDefaultImageSize();
$image = imagecreate($imageSize['width'], $imageSize['height']);
imagecolorallocate($image, 54, 175, 105);
…

Stefan K.
- 23
- 3
1
vote
2 answers
How to validate depending on the selected value?
I have a simple form:
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('name', null, ['required' => true])
->add('doYouWant', ChoiceType::class, ['choices' => ['no' => 'no', 'yes' =>…

kuvoc
- 11
- 2
1
vote
2 answers
How to limits results by main entity, not with childrens?
How to limits results by main entity, not with childrens?
If I do:
$queryBuilder = $em->createQueryBuilder();
$queryBuilder->select('n, c');
$queryBuilder->from('AppBundle:News', 'n');
$queryBuilder->leftJoin('n.comments', 'c');
…

vosavik
- 11
- 2
1
vote
0 answers
Symfony3.4 - Send a Server-Sent Event when something happens
I'm developing a project with Symfony 3.4.
I would like to send a message to all the clients currently viewing a page when something happens. I evaluated both Server-Sent Events and Websockets, and I decided to go with the former, because the…

user1923631
- 383
- 2
- 5
- 15
1
vote
2 answers
Symfony 3.4 dynamic content on routes (listener ?)
I would like to have dynamic content on several pages of my application. This content would be stored in my database and an admin could update it when ever he wants.
Is it possible to create a listener executed every time a route is called to check…

Kirk_
- 23
- 3
1
vote
2 answers
Test a Symfony REST API using Behat / Mink : prb with POST request
My challenge here is to find the best way to test a Symfony (3.4) API application using Behat/Mink for functionnal test, in my CICD platform.
Because my testing processes must be called in a shell script, all the tests must be very linear. I have no…

JayMore
- 642
- 6
- 20