Questions tagged [symfony2]
Symfony2 is an open source PHP web development framework for PHP 5.3.9+ focusing on easy and fast development cycles and including state-of-the-art design patterns and programming philosophies. Symfony should not be confused with Symphony CMS
30 questions
1
vote
0
answers
715
views
Symfony controller to register and activate users
I've been in an interview some time ago. They objected my Symfony API code with following line:
Too much code in controller actions. Can be moved to services to keep
the business logic apart from ...
2
votes
1
answer
151
views
Model database for contract renewal
I have made a contract renewal system in Symfony and Doctrine, and it works, but I think it can be improved, but I make too many requests to the database.
These are my models:
...
5
votes
1
answer
100
views
Migrate data between tables efficiently
I wrote a very simple quick and easy script to migrate a bunch of data to another table in my database.
Can I accomplish this task without using so many foreach loops?
I realize I'm imputting ...
2
votes
1
answer
541
views
MVC controller and action that handles favorite items in a session-based list
I've written a Controller and a corresponding Action for a Symfony 2.8 project, that does the following:
handles a list of favorite items of a user
the ids of the favorites are stored in the session
...
3
votes
1
answer
246
views
Redirecting the web client after deleting an item
In my web-app, it is possible to delete an Item when visiting any of 4 different pages:
the Show Item page
the Edit Item page
the List Items page
the List Items in Room page
If the visitor uses a ...
2
votes
1
answer
982
views
Doctrine/Symfony WHERE clause for reports
I'm trying to generate a report from two doctrine entities.
The fields to filter the report are optional. This is the code I've got now and it looks really bad to me. How can I improve this?
...
0
votes
1
answer
106
views
Updating data on a blog
I want to make post editing on my blog. I get data from a form and want to put it into a database. I'm not sure if using setters is the best way, so maybe you can show me better solution?
...
1
vote
1
answer
2k
views
Preventing XSS in a Symfony form to add a timetable entry
I have started to implement cross site scripting prevention (xss) within my code.
However as I am using symfony for this particular project I have read up that nothing needs to be done for xss in ...
4
votes
1
answer
1k
views
PHP routing system
I made a routing system for PHP inspired by Symfony's router composed of a few classes.
First I am using Symfony's HTTP Foundations component.
Then, I am emulating the classes in the routing component ...
2
votes
2
answers
825
views
Validating user credentials and logging into a Symfony site
I have the following code in a Symfony site that validates a user's credentials and logs them in via the Session class:
...
4
votes
1
answer
216
views
Using a separate class in Symfony to handle a list of entities with controller injection
In my Symfony (v2.7.9) project I have a set of entities which share some view functionality i.e being displayed in a table with some of their values as columns.
Following the separation of concerns ...
5
votes
3
answers
250
views
Get similar posts with manyToMany relationship
I have a table post with a many-to-many relationship with the tag and product tables.
...
2
votes
1
answer
828
views
Silex - Guzzle call to external API
I'm at the point where I am happy with the functionality of my code but I dislike how its written. It seems like I can be more modular with it but I can't seem to figure out how to improve on it ...
4
votes
1
answer
86
views
Inserting and updating data for a website monitoring app
I have created an app in which URLs stored in a database are pinged via curl to check their availability and the database is updated with the results.
Two tables are updated with each fresh ping of a ...
2
votes
1
answer
121
views
Logging and getting the response in a controller
I have an action that does two things:
It sends a chain of commands, and gets the response from an external API that we call wrapper.
It logs the chain of commands ...