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

learn more… | top users | synonyms

0
votes
0answers
12 views

Is this the best way to update data in Symfony2, Doctrine

I want to make post editing on my blog, I get data from form and want to put it into database. This is how it looks like: ...
1
vote
1answer
56 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 ...
1
vote
0answers
37 views

Inheritance and Association implentation in Symfony 2.7 and Doctrine

I've a working implementation in Symfony2 with doctrine of the following model. A Parent can apply for one/more Training(s) A Training is based on a specific Skill, but you can have multiple ...
3
votes
0answers
84 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 ...
2
votes
2answers
125 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
1answer
77 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 ...
0
votes
1answer
163 views

Symfony2 (2.7), Embedded Forms, Persist failure [closed]

I am trying to implement Embedded Forms (Symfony2, 2.7), with a three layers situation: Job, Task and Tag entities, One2Many relationships. So, what I am trying is just to develop a very basic web ...
5
votes
3answers
132 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
1answer
257 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
1answer
44 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
1answer
78 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 ...
0
votes
2answers
719 views

Shuffle Symfony entities

I've got an object $contest which is a Symfony entity that has some other entities assigned. I can get them by ...
1
vote
0answers
191 views

FilesSynchronizer: Synchronize local and remote filesystems

I have written a library that syncs files between two filesystems. It works fine, but I'd like some other developers to have a look over the existing code. Maybe I can optimize something. It is using ...
3
votes
1answer
66 views

Tag manipulation using DOMDocument

On our main symfony2 application at work I have had to manipulate some outputted grid fields by wrapping them in a hyperlink tag. This happens in quite a few different controllers, so I made a method ...
2
votes
0answers
61 views

View helper for creating HTML elements with DOM

I have attempted to create a view helper class which makes programmatically creating HTML strings less verbose and hopefully simpler. This is inspired by the tag helpers in Rails. It's compatible ...
2
votes
0answers
55 views

Which pattern could help to refactor this controller code?

I know I should use services and patterns to refactor this controller action, but I can't imagine one that could fit/be appropriate for this problem. It seems a strategy or template, but a strategy ...
28
votes
2answers
10k views

Trait accessing variables of classes using it

I just tried PHP Traits for the first time, to keep my code DRY : ...
4
votes
2answers
3k views

Fetching objects and adding a calculated field in Doctrine 2

I'm making a section that shows a list of blogs and how many comments it has without loading any comment data. My Blog entity is as follows: ...
1
vote
1answer
118 views

Checking if a relationship exists

I'm using a many-to-many relationship between users and roles with propel: ...
2
votes
1answer
3k views

Uploading a file using Symfony 2.5 strictly

Recently I have been looking into Symfony framework and I am working on a task where I need to upload a file using a form. Once the form has been submitted I need to insert the user input along with ...
3
votes
0answers
368 views

Building a console application using a DI service container

I am working on a project that will allow developers to create a console application using a dependency injection service container. Both the console and container are Symfony components with some ...
6
votes
1answer
113 views

Uploading file for related entity

I see that my code smells. The first file is a controller, and createAction. But I don't know where to delegate this. BookController.php - Whole controller class So this is most 'smelly' code to ...
1
vote
0answers
188 views

Form-processing controller action

I have a fairly ugly controller method I would like to refactor / extract. I can only test this in an integration-type test which kind of signals a code smell. The method processes the form and needs ...
3
votes
1answer
2k views

Linking to an image asset from a JavaScript file in Symfony 2

I am calling a JS file from a bundle directory like so: <script src="{{ asset('bundles/macppages/js/main.js') }}"></script> which loads the JS file ...
2
votes
1answer
120 views

Handling library entity

Below you'll find a Symfony2 service I wrote to assist in handling the Library entity. Each user in my app has a personal library where one can upload items to and a purchased library, that contains ...
0
votes
1answer
191 views

Database “design” using Symfony2 and Doctrine2

I'm working on an application, which tracks expenses. I have users, and each user can create his categories for the expenses (like Food, Bills, Transport, Drinks, Clothes) and then create expenses - ...
3
votes
1answer
1k views

Friends edit form

I have a list of friends and new friends are added via a form. When you click on a friend you see all the information about him. There is also an Edit button. When clicking it, I want a form to be ...
3
votes
1answer
3k views