Tagged Questions
Symfony2 is an open source PHP web development framework for PHP 5.3.3+ focusing on easy and fast development cycles and including state-of-the-art design patterns and programming philosophies.
0
votes
0answers
4 views
Symfony2 is not displaying the error when using createNotFoundException()
I am using Symfony2 and it is not displaying an error when createNotFoundException() is called.
It is just showing a blank white page.
Here is my code that is throwing an exception:
if(!$product){
...
0
votes
0answers
7 views
The class was not found in the chain configured namespaces
I'm doing a project in Symfony2 and I've got 2 databases: default and client. In the default I've got some stuff related to an e-commerce store and the client is related to content of the ...
0
votes
0answers
16 views
Duplicate entry mysql error when loading fixtures in symfony2
I started to learn symfony2 after I used symfony 1.4. I use the jobeet tutorial for symfony 2.3. I'm at day 6 where I should add an expired job with fixtures. I'm totally screwed up. I follow every ...
0
votes
1answer
32 views
Tell Doctrine to use different MySQL users based on use
Fairly simple question really, but is there any way at all, to get Doctrine (when using Symfony's console) to use a different database user than the ones provided in the parameters?
Edit
Was ...
1
vote
1answer
17 views
Symfony2: No route found /demo/contactus
I am new to symfony and following the AcmeDemo i created a new page for Contact Us. At the moment it is working for the url localhost:8000/contactus but following the same implementation of ...
0
votes
1answer
13 views
Foreign characters in ISO-8859-2 encoded file
I have to do CSV file export, and that file has to have ISO-8859-2 character encoding, and display properly foreign characters.
The controller looks like this:
public function exportAction(Request ...
1
vote
1answer
9 views
RESTFul OAuth with FOSOAuthServer / FOSRest & FOSUser
I'm having difficulties to fully understand the concept of the client creation explained here.
I followed the post to set up the OAuthBundle, and tried to make the changes needed to comply with ...
0
votes
1answer
21 views
symfony2 get property values from form
i have a symfony entity called Config
class Config
{
/**
* @var integer
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var ...
0
votes
2answers
23 views
symfony2 set a refresh button
Can i implement a refresh button in twig template that will reload my entity data on click ?
Here is my controller :
public function indexAction() {
$repositoryForHistory = ...
0
votes
0answers
13 views
Weird Symfony2 error logs with JS encoded codes in paths
We found suspicious logs in our Symfony2 application:
PHP Fatal error: require(): Failed opening required '/var/www/apps/symfony2/vendor/symfony/symfony/src/Symfony/Compone\xc8 i+m\x7f'
PHP Fatal ...
0
votes
0answers
16 views
File upload with blueimp jQuery file upload, doesn't work in IE9
have create an upload functionality with jQuery-file-upload, my upload work in Firefox, Chrome and IE version more than 9.
I have try to force iframe transport, recommended by doc of ...
2
votes
2answers
27 views
How do I upload a multipart form in AngularJS?
Form view:
<form enctype="multipart/form-data" ng-submit="upload(file)">
<input type="file" ng-model="modal.file" accept="image/gif" app-filereader /><br />
...
0
votes
1answer
23 views
Symfony2 inject an array of services into a controller from config.yml
How I can inject an array of services from config.yml giving class names (with namespaces) to a controller? I need to run a function from each of this services in the controller. At the moment I use ...
-1
votes
2answers
30 views
Images in Symfony2
I am new in Symfony 2 and i need your help. I want to output pictures uploaded by user to web/uploads/photos. But I dont know how I can access to that files, always get 404 error. I read this pages:
...
0
votes
0answers
10 views
Symfony2 Propel SoftDelete and Dependency injection
I used to have soft delete in symfony 1.4 setting except datetime of deletion also the username of the user who soft deleted the object. It was easy then with using sfContect::getInstance() inside the ...
0
votes
0answers
31 views
Symfony 2 : validation.yml has no effect
To validate my class DeclarationForm :
class DeclarationForm {
private $identifiant;
private $qualiteInterlocuteur;
private $nomCible;
private $reference;
private $description;
private ...
0
votes
2answers
15 views
DateTime Symfony2 hydrating/persisting
So i have this weird problem i don't really understand. I'm just trying to hydrate an object with two datetimes, "beginning time" and "ending time". I get the ending time by adding a DateInterval (3 ...
0
votes
2answers
28 views
How to get environment in custom route loader in Symfony2?
I've created a custom loader for my bundle with the purpose of loading different routes per environment. My loader class looks like this:
class ApiRouteLoader extends Loader
{
public function ...
0
votes
1answer
17 views
FOSRestBundle ignores unauthorized challenge config
I am creating a REST-API and currently have Basic Auth defined as authentication.
Symfony firewall config:
secured_area:
pattern: ^/
anonymous: false
http_basic:
realm: ...
0
votes
1answer
34 views
Symfony2 cannot find my doctrine2 entity class in the controller - how to fix?
I'm trying to run a simple SQL statement (something like select * from table) in my Symfony2 controller but it's not working. Somehow Symfony cannot find the class.
some info:
I've tried providing ...
0
votes
0answers
16 views
how to get property from FacebookRequest
when i do :
$user_profile = (new FacebookRequest($session, 'GET', '/me'))->execute()->getGraphObject(GraphUser::className());
i can get property like this
$result['firstName'] = ...
0
votes
1answer
18 views
How to create custom escape strategy escaping only double quote (for json) in symfony & twig?
A customer wants double quotes and only double quotes escaped for a json output. This means single quotes should not be escaped as per the default twig html escape strategy, for example:
"2565": ...
0
votes
2answers
30 views
Access Container or securityContext or EntityManager from MenuBuilder through RequestVoter
I found this piece of code shared in a Gist (somewhere I lost the link) and I needed something like that so I started to use in my application but I have not yet fully understood and therefore I am ...
0
votes
2answers
22 views
How to fix “Class XXX is not a valid entity or a mapped super class” error when using php app/console (Symfony2/Doctrine)?
I'm following this Symfony2/Doctrine guide and I've come to the part where I need to create getters/setters. but I am stuck with this part:
$ php app/console doctrine:generate:entities ...
0
votes
1answer
28 views
Trying to setup Memcached with Symfony running on NGINX/HHVM
I have memcached installed and working as tested by:
nc -U /var/run/memcached/memcached.sock
stats
STAT pid 16360
STAT uptime 2246
STAT time 1412217254
STAT version 1.4.14 (Ubuntu)
STAT libevent ...
0
votes
0answers
15 views
Treat twig syntax error / exception as string to render as email template
Hello I'm make a web app, enable people to send email from email template defined by them.
I'm using Symfony2 and Twig for template engine.
I want to treat Twig's Twig_Syntax_Error exception as a ...
1
vote
1answer
15 views
Symfony bundles using the same vendor name in /src and /vendor
I'm breaking some of my bundles into stand alone repos that I can reuse in other projects, they are all under the same vendor namespace in my /src directory, so when I pull them out and require them ...
1
vote
0answers
20 views
How can I convert a binary string from a form to a file in Symfony2?
I have a REST api, and I'm submitting GIF files to it basically. It's returning a 400 error though.
This is the code that handles the conversion at the minute.
$imgstr = $params['file'];
...
1
vote
0answers
16 views
Symfony session is empty after login when using a custom DynamoDB session handler
I'm pulling my hair out over this one.
I have implemented a Symfony session handler using DynamoDB and the AWS PHP SDK: ...
0
votes
1answer
19 views
Symfony2 Choices from Entity Field
I have an entity ChoiceQuestion which has a field Options.
Options is defined as an Array.
<?php
namespace Survey\SurveyBundle\Entity;
use Survey\SurveyBundle\Entity\BaseQuestion;
use ...
0
votes
2answers
31 views
How to get uploaded image file format without using guessExtension()?
I have a laravel 4.1 project running on PHP 5.3.28 and I am trying to find a way to get the file extension from a certain image that fails whenever I use guessExtension() like so:
$format = ...
0
votes
1answer
11 views
FOSUserBundle Symfony2. Extra Login Field
i am using fosuserbundle to login users and this is working fine.
But for a new project i want a 3 field login like this :
Field Companyname
Field Username
Field Password
My question is how to ...
0
votes
1answer
12 views
KnpMenuBundle need to add custom css and html to the link
I am using the KnpMenuBundle and I am needing to add custom css and an tag to one of the links that have with the route of 'uri'=>'#'. How would I accomplish this?
I want the link to look like ...
1
vote
1answer
21 views
Symfony 2 : bind request to form object containing objects
I am trying to do something that I am not sure it is possible to do.
Here is my form object :
class DeclarationForm {
private $string1;
private $paramObject;
}
Here is the Param Object :
...
1
vote
1answer
21 views
Symfony 2 Routing Annotation with container parameter
I am trying to "port" yml routing to annotations.
In yml I have route:
homepage_foo:
pattern: /foo
defaults: { _controller: FooBundle:Homepage:foo }
schemes: [%httpProtocol%]
where ...
1
vote
0answers
19 views
No route found for “GET /” in NGINX conf
(first at all, sorry for english it's not my native :/ )
I have a problem with my NGINX conf, I have 2 symfony2 projects in 2 folders. The first one is my root dir (www.mywebsite.com/) in my nginx ...
1
vote
1answer
25 views
Set collection according to property value and update via AJAX
I have an email object which contains a collection textareas and has a property template. The collection textareas contains the textareas in template, which are set in the controller.
public function ...
0
votes
1answer
30 views
Symfony 2 - No route found error
I have trouble with Symfony od my new server - if I want to run Demo application, have error message in log:
request.ERROR: Uncaught PHP Exception ...
0
votes
1answer
10 views
Accessing parameters within CLI class
How can I get parameters from a yml file in class below so that I can print it with CLI?
Error:
mbp:symfony em$ app/console phing:report
PHP Fatal error: Call to undefined method ...
0
votes
0answers
14 views
Symfony DaoAuthenticationProvider No encoder has been configured for account
I'm trying ti setup default login system and get this message
No encoder has been configured for account "Crm\Bundle\ManageBundle\Entity\ManagementManager".
My setup is
Security.yml:
security:
...
0
votes
1answer
22 views
Twig strip part of string if true
I was wondering if it is possible to strip part(s) of a string when the string contains a word. I've read the doc here but that's not exactly what I'm looking for.
Let's say I have this:
<ul>
...
-1
votes
0answers
33 views
How to create database in symfony controller
I am working on a SF2 project and I need to manage multi-tenant databases. For example, when one user signup for the plan, I need to create new database for that use like [USER_NAME]_db.
I have ...
0
votes
1answer
25 views
How to retrieve the related entities for an entity?
I'm designing a messaging API, and I have set a PUT /message method.
The payload consists of an array containing three fields: message, sender and receiver – the first one is the message itself and ...
0
votes
0answers
7 views
sonata admin custom list field (not from entity)
Sonata admin bundle documentation seems scarce and I did not find a way implement this.
Goal: display boolean value in field list. Value should calculated for each object from other properties.
I ...
0
votes
0answers
7 views
Wide characters when using twig's convert_encoding function
I have a variable and I have to change its encoding. The code looks like this:
{{ payroll.fvatAddr|slice(0,32)|lower|title|raw|convert_encoding('UTF-8', 'ISO-8859-2') }}
So I'm converting UTF-8 to ...
0
votes
0answers
26 views
Appkernel can't find my bundle after installing it in composer
I'm trying to install a bundle from a local repo.
the composer.json of this bundle is :
{
"name" : "my/bundle",
"description" : "My Bundle",
"type" : "symfony-bundle",
"authors" : ...
0
votes
2answers
38 views
naming a file after submitting a form in Symfony
I am working on a form which accepts some user input and an image file, the submission part and the data getting entered into the database is working fine but I am stuck at how to name a file once it ...
0
votes
1answer
20 views
Symfony2 Memcached - LeaseWeb/LswMemcacheBundle Not work in development mode
Am using Symfony2 in my project and i added this bundle "LeaseWeb/LswMemcacheBundle" to use memcahced , the problem that its work fine for me in the production mode and in development mode show me ...
1
vote
0answers
20 views
Persisiting Many-to-Many with extra field in sonata admin
Multimedia, Gallery and GalleryMultimedia.
Both Multimedia and Gallery have a One-to-Many relationship with GalleryMultimedia which holds multimedia_id, gallery_id and position.
In my ...
0
votes
1answer
29 views
Symfony2 Embed form on multiple entities
I have 3 entities
User
class User extends BaseUser
{
/**
* @ORM\OneToMany(targetEntity="UserPathologie", mappedBy="user")
*/
protected $userPathologies;
}
Pathologie
class ...