Questions tagged [symfony]

26243 questions
1

votes
1

answer
459

Views

Symfony AbstractController Not Found After Composer Update

I just ran a composer update and now when I try to access my website I get this error: ClassNotFoundException in SecurityController.php line 28: Attempted to load class 'AbstractController' from namespace 'Symfony\Bundle\FrameworkBundle\Controller'. Did you forget a 'use' statement for another name...
LargeTuna
1

votes
1

answer
47

Views
1

votes
1

answer
43

Views

Execution of php file with commande

I use symfony 2.8 for my project. this is the code of php file that i would to execute with commande: use Video\IntelligenceBundle\Entity\Entry; use Video\IntelligenceBundle\Entity\Visits; use Doctrine\ORM\EntityManager; use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; use Symfony\C...
Melek
1

votes
0

answer
56

Views

Symfony does not read the base path propely after url rewrite

I've rewritten all urls from /api/(.*)$ to /api/public/index.php/$1 using this nginx configuration: location /api/ { try_files $uri @rewriteindex; } location @rewriteindex { rewrite ^/api/(.*)$ /api/public/index.php/$1 last; } location ~ ^/api/public/index\.php(/|$) { fastcgi_pass unix:/var/run/php-...
P. Danielski
1

votes
0

answer
52

Views

Unsupported index types through migrations. Schema:update wants to remove some

I have a symfony 3.4.2 + doctrine 2.6 project using postgresql 9.6. I am trying to add some unsupported index types. I found this issue which points out that migrations should be used for this purpose. My problem is that the migrations work for 2 out of 3 indices. But doctrine:schema:update wants 3r...
Evren Yurtesen
1

votes
0

answer
435

Views

Symfony/Process fails with exception

I'm trying to execute standalone chromedriver for linux with the Symfony/Process component. Here is the folder structure of the project: . ├── bin │   └── chromedriver-linux ├── composer.json ├── index.php └── vendor In index.php this is the code that I'm trying to...
lostbyte
1

votes
1

answer
129

Views

Is it possible in Twig to set autoescape strategy in the layout file

I have a layout file that has a {% block content %}{% endblock %} inside a Javascript array like this cols:[ {% block content %}{% endblock %} ]; And then is extended like this in the many templates that use the layout file like this (the real templates have many more lines of code and variables): {...
Technofrood
1

votes
0

answer
40

Views

Sonata E-commerce order bundle

I have just installed the sonata e-commerce OrderBundle, I want to add new field in order_order table without changing anything into the vendor. I have try it with add field into the Order entity, But it is not working. Please help. Thanks
Maulik Savaliya
1

votes
3

answer
720

Views

How to handle deadlock in Doctrine?

I have a mobile application and server based on Symfony which gives API for the mobile app. I have a situation, where users can like Post. When users like Post I add an entry in ManyToMany table that this particular user liked this particular Post (step 1). Then in Post table I increase likesCounter...
Tom
1

votes
1

answer
46

Views

Is it possible to combine fetch joins and COUNT in Doctrine?

I want to fetch join some entities to avoid a lot of additional queries and I also want to get count of related collection. Something like this: SELECT u, a, count(p) properties_count FROM User u JOIN u.address a LEFT JOIN u.properties p group by u.id That is I want to get a collection like [[0 =>...
AlexP11223
1

votes
0

answer
67

Views

Transform address string to (new) address entity before persisting data to database using a Symfony DataTransformer

I have a problem defining a special kind of form using Symfony2 3.3. General description of the problem: Storing postal address data in a flexible and clean way with reduced duplicates is a difficult task, because there are so many combinations of address components like street, streetnumber, zipcod...
A. Schmidt
1

votes
0

answer
181

Views

Use glob pattern to include controllers annotations routing with Symfony 4

I want to include all controllers for route annotation, giving a routes/annotations.yaml: controllers: resource: ../../src/{Site,Dashboard}/Controller/ type: annotation The glob component is not giving folders but null (whereas files exist). How can I use glob pattern in such way?
Thomas Decaux
1

votes
0

answer
103

Views

'Symfony3' - 'fosuserbundle' form - add group to user

I use Symfony 3 with the fosuserbundle, and want to create a form, that will add multiple groups to one user. The layout is not the problem, but to building the form and submitting... Here is the sourcecode with the important parts: https://pastebin.com/tyFP8XGK The current problem is that if I ha...
padhie
1

votes
1

answer
286

Views

SonataProductBundle (symfony 2.8) instead of showing product create form there is “No object types available” button appearing

There are Sonata Admin with enabled SonataProductBundle. Product entity configured accordingly to documentation. But, upon attempting to create new 'Product' in admin panel, 'No object types available' button appears instead of edit form of. Here are the configurations: config.yml imports: - { res...
Neha
1

votes
0

answer
403

Views

Symfony - Api Platform - How to automatically add the authorized user as a resource owner

I'm building an API using the new Symfony 4 and API Platform, and what I cannot seem to gather from the documentation is how to automatically add the currently authorized user to a resource upon creation. I am using JWT authentication, and /api/ routes are protected from unauthorized users. I want t...
Danielle Suurlant
1

votes
2

answer
224

Views

passing the EntityManager from an EntityType to another EntityType

I'm using Symfony 3.3. - Summary: I have a form which I have to validate in the Controller, the entity used in the validation contains an ArrayCollection attribute, which means that I'm going to validate an embeded forms using 2 EntityType classes (a parent one having a CollectionType of child one)....
1

votes
1

answer
43

Views

trying to upload a file with synfony 2

i'm trying to upload a file in my database with symfony, I modified my entity, and my form. But when i click on upload a document, i have no error but nothing append (I have no new doc in C:\wamp64\www\myproject\web\upload, and my database field, here support, is null). Here is the code of my entit...
Antoine Bernard
1

votes
1

answer
523

Views

Submit editing modal (Symfony)

Actually i have a problem and i still can't find the right solution for it, here is my issue : I am using PHP Symfony to develop an application, but when i tried to have an editing form on a modal the save button doesnt work (i can get the datas on the modal but the modal isnt operationnal), here is...
Saritta091
1

votes
0

answer
326

Views

Symfony3 404 exception response return with status code 200 instead of 500

I am new in symfony,I have facing one problem in Production Environment after I add kernel.event_subscriber in service.yml. problem is before adding event subscriber in service.yml file It return 500 HTTP_STATUS_CODE & Resource Not Found exception occur with my custom page in twingbuddle That I set,...
Sandeep Gajera
1

votes
0

answer
346

Views

Symfony EasyAdmin ManyToMany error when adding : Could not determine access type for property “users” in class “App\Entity\Subject”

I'm trying to do a simple ManyToMany relation between two classes with easyAdmin, when I'm trying to add, nothing happened, so in the configuration yml I added the by_reference false, but I have constantly this error: Could not determine access type for property 'users' in class 'App\Entity\Subject...
akali leona
1

votes
1

answer
61

Views

Empty uploaded file in Symfony with unknown User Agent

I am using Symfony for a collection of REST APIs and I keep getting an exception of an empty uploaded file. It happens about 5-10 times every day in an application which has about 5000 users per day. This is the relevant code: $receipt = $request->files->get('receipt'); if (!$receipt || !($receipt i...
StockBreak
1

votes
0

answer
169

Views

Autocomplete field set created value

I'm using Sonata 3 in my project. I faced with the problem with autocomplete field. protected function configureFormFields(FormMapper $form) { $form ->add( 'contactPerson', ModelAutocompleteType::class, [ 'label' => 'Contact Person', 'property' => 'name', 'model_manager' => $this->modelManager, 'cl...
klipach
1

votes
0

answer
100

Views

Symfony Repository service configuration with multiple connections

I have a Symfony app with two different database connections. Until yesterday I only needed the default connection but now I need the other one. I configure my services in yaml and I have absolutely no idea what I have to do differently for the other connection to inject my repository. The configur...
jvda
1

votes
0

answer
39

Views

Symfony client not updating result

In my code, I have URLs that I want to check with \Symfony\Bundle\FrameworkBundle\Client When I launch my test, I get500 Internal Server Errors. I check in my browser, I have 500 Internal Server Error also. I fixed the issues, checked again with my script and still have the errors. But when I check...
ReaperSoon
1

votes
0

answer
297

Views

PHP Fatal error: Class 'Twig\Extension\AbstractExtension' not found

I've tried updating Symfony to v2.7.40 today. At the end of the update process while clearing the cache I encounter PHP Fatal error: Class 'Twig\Extension\AbstractExtension' not found In my composer.json I already have required and installed 'twig/extensions': '~1.5' Do I need to update any other b...
Stev
1

votes
0

answer
505

Views

symfony4 swiftmailer non-existent class or interface: “Swift_Mailer”

after having installed swiftmailer with composer on symfony4 composer require mailer I've written a small function to test it /** * @Route('/testmail', name='testmail') */ public function mailAction(\Swift_Mailer $mailer) { $message = (new \Swift_Message('Hello Email')) ->setFrom('[email protected]') -...
Sébastien Grognuz
1

votes
0

answer
108

Views

Symfony4 security login form

I have a problem with login form in Symfony4. I use FOSUserBundle for security on my site, but i can't log in. It's my code: security.yaml security: # https://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers encoders: App\Entity\User: algorithm: sha512 providers: us...
PawiX
1

votes
1

answer
291

Views

symfony 3 route not found for login/ register

I dont use FOS What is wrong? My links directs to 'login' and 'register' and I am getting this: No route found for 'GET /login/' Also getting this for register No route found for 'GET /register/' My debug:router looks like: Entity and Controller are in UserBundle routing.yml:
Jakub Stanek
1

votes
0

answer
403

Views

Symfony3 - Validation of an embedded form

I have an embedded form like this: -> Parent (class) |---> Attribute 1 (collection) : children (class) : required .......|-----> Attribute 1 : child_name (string) : required .......|-----> Attribute 2 : child_description (string) : required I want, when I send the form: There is at least one parent...
1

votes
0

answer
68

Views

Symfony - where should be csrf validation done when not using symfony forms component?

From the documentation I see it is done in controller: https://symfony.com/doc/current/security/csrf.html public function delete(Request $request) { $submittedToken = $request->request->get('token'); // 'delete-item' is the same value used in the template to generate the token if ($this->isCsrfToken...
Darius.V
1

votes
0

answer
473

Views

Moving Symfony from development to production

I have made some web sites using Symfony 4 that work using the PHP server on my local machine. When I FTP the Symfony project-directory to my 1and1 Linux web host I can not get the web sites to show up in my browser. I have tried to implement the guidelines on the Symfony documentation for doing thi...
user3425506
1

votes
1

answer
49

Views

Create multi entities in Symfony4 Unit tests

Since few days, I'm trying to learn Symfony Unit Test. I made my first test but I noticed one thing : For my first test, I tested a simple implode for some tags : class TagsTransformerTest extends TestCase { public function testTransform() { $tagsArray = [ $this->createTag('Symfony'), $this->createT...
Piface
1

votes
2

answer
535

Views

KNP menu Symfony 3.4

I'm having a hard time getting this to work, I get the following error: Unable to find template 'KnpMenuBundle::menu.html.twig' (looked into: D:\Server\htdocs\symfonudem\app/Resources/views, D:\Server\htdocs\symfonudem\vendor\symfony\symfony\src\Symfony\Bridge\Twig/Resources/views/Form). Below is my...
Ndong Akwo
1

votes
0

answer
24

Views

Symfony3- can´t access to collections data (get)

I have an object with several collection. I saved the data correctly and then, when I do 'object->getCollection()', I didn´t obtain the data. This are my entities: Persona: /** * @ORM\OneToMany(targetEntity='PersonaDomicilio',mappedBy='idPersona',cascade={'persist'},orphanRemoval=true) */ public $d...
1

votes
0

answer
554

Views

Symfony config | trusted hosts | Correct regex pattern for any subdomain?

I'm working on my first Symfony-based application and I want to use the 'trusted_hosts' option to make my app a little more secure. I started developing by using Symfony's own HTTP server which ran under 'localhost'. But I also have an Apache with correct vHosts setup for www.domain & dev.domain. I...
BuddhaBone
1

votes
0

answer
68

Views

Render a base template multi time using Twig

I have a base template contains blocks which has to be filled by some render template's output. The problem is that when I pass $parameters to $template->render all twig variable display tags ({{ x }}) will be replaced with empty strings. So in next render call there is no block name to be replaced...
1

votes
1

answer
324

Views

Autowiring Custom DBAL connection in Symfony 3.3

Hello friends of symfony. I'm building a project that needs 2 connections to database. And it works nice, but if I want to get/use the second (called customer) connection by dependency injection instead of $this->container->get('doctrine.dbal.customer_connection'); it takes the default connection. I...
1

votes
2

answer
74

Views

Doctrine : SELECT a relationned entity

I have 2 entities : LinkServInfra Serv LinkServInfra entity : id serv (relation OneToOne to Serv) infra (ManyToOne to another entity) Now, I'd like to get a list of Serv based on infra. So I tried in LinkServInfraRepository : $qb = $this->createQueryBuilder('s') ->select('DISTINCT s.serv') ->wher...
Bastien Nicolau
1

votes
0

answer
101

Views

[symfony][DoctrineMongoDBBundle] Error when generate schema indexes

I'm using Symfony3 and DoctrineMongoDBBundle. When I try to generate the mongodb schema I get the next Notice and, although I have the collections created, the indexes does not exists. $ bin/console doctrine:mongodb:schema:create Created dbs for all classes Created collections for all classes Notice...
Manel Pérez
1

votes
0

answer
288

Views

Symfony 3.4 - Can we collect code coverage for functional testing?

I am using symfony 3.4 for some of our projects. According to the docs, we should write functional tests for ours controllers. However, it seems that we cannot collect code coverage for functional test because symfony will run main code in another PHP processs. In phpunit process: var_dump(xdebug_c...
Pha

View additional questions