Questions tagged [symfony-components]

Symfony Components are standalone classes which implement common features. They are the foundation of the Symfony framework.

The Components

All components as of Symfony 2.3.0:

72 questions
3
votes
1 answer

XPath element selection containing a text with accents or characters

I want to select an element/div tag by using XPath (Symfony Dom Crawler): $element->filterXPath('//span[text() = "SOMEtext"]')->text(); It works fine if there are no special characters in the string. It won't work if a string contains the accents or…
aspirinemaga
  • 3,753
  • 10
  • 52
  • 95
3
votes
1 answer

serviceContainer returns an IdentityTranslator in symfony 2.8

I'm trying to use the translation component but I'm not able to get it - and use - properly. When I request /testT: namespace Codechick\Test2Bundle\Controller; class DefaultController extends Controller { /** * @Route("/testT") */ …
Bertuz
  • 2,390
  • 3
  • 25
  • 50
3
votes
1 answer

Make a symfony/console command accept key=value arguments

I want to use the Symfony console component to make a command like this: app/console config:set someConfigName=someValue anotherConfig=anotherValue I found this question: Variable number of options for symfony/console component But it seems…
paul-m
  • 214
  • 1
  • 7
2
votes
0 answers

Override/Update Variable/Array in php file

In my recent project, working on console command where I need to perform/run various action mentioned in json based on the linux standard convention as what:mv(Move),type:file,dir what:mkdir(Make Directory) what:touch(Make File) what:cp(Copy),…
Safoor Safdar
  • 5,516
  • 1
  • 28
  • 32
2
votes
0 answers

Do not allow to change a default option using optionsResolver of Symfony

I am using the optionsResolver component of symfony I have the following code: public function test($group, array $options = []) { $this->resolver->setDefaults([ 'query' => ['group' => $group], 'form_params' => ['user' =>…
gmponos
  • 2,157
  • 4
  • 22
  • 33
2
votes
0 answers

Symfony2 - throwing AccessDeniedHttpException don't work EDIT: Security

I would like to remove unwanted effect of redirecting when somewhere is thrown AccesDeniedException. I mean redirecting to "login" page if user is not authenticated. I created kernel.exception listener class ApiAccessDeniedListener implements…
Griva
  • 1,618
  • 20
  • 37
2
votes
1 answer

Symfony2 - Finder Component

I want to find specific texts in some files in a directory. I tried using Symfony Finder Component, but couldn't get the result. Here is my code below. $finder = new Finder(); $finder->in('./sample')->files()->contains('This is test'); The files…
2
votes
2 answers

Map the router placeholder with the URI values

I don't how to explain this so please be easy on me. The router holds the uri variable key $router = 'movie/english/{slug}/edit/(id}/{title}'; The URI in the browser address bar $uri = 'movie/english/scorpion/edit/125/E01E05'; How can I write the…
Red Virus
  • 1,633
  • 3
  • 25
  • 34
2
votes
1 answer

Symfony2 components class not found

I am trying to use the Request & Response components of Symfony2 without the full framework. Here is my code:
2
votes
1 answer

How to access dynamic references from other container items?

How can I pass a dynamic dependency from one registered container definition to another? In this case, a generic Database object wants to inherit from a generic Config object. The twist is config is not static, but loaded depending on a given…
John
  • 45
  • 5
2
votes
2 answers

proc_open Too many open files in long running Symfony Console app

I built a console app with Symfony Console component. It supposed to be run for 5 hours. But after running 2 hours i have a proc_open(): unable to create pipe Too many open files error in Symfony\Component\Console\Application.php on line 985. I…
Can Vural
  • 2,222
  • 1
  • 28
  • 43
2
votes
1 answer

Silex don't direct after successful login

I'm having a little issue using Silex and security service. When a user enter his data (correctly) into my login form, it doesn't get redirected to app url. He remains in the same page, and debuging, in the login form page, donesn't have anything in…
joaobarbosa
  • 630
  • 5
  • 13
2
votes
1 answer

Why does XSendfile emit intermittent garbled responses when used with Symfony Components BinaryFileResponse class?

Background Part of my application's responsibility is handling requests for static resources (CSS, JavaScript, images) in a controlled manner. Based on some application logic, it will return one from a selection of different files that might be…
leftclickben
  • 4,564
  • 23
  • 24
2
votes
1 answer

Certain selector syntax not working in Symfony2's CssSelector component (within DomCrawler)

I have a question about the dom crawler, or more specifically, the CssSelector Component. When I run $descendants = $crawler->filter('ul > li'); on a multi dimensional list, I get all direct children. But when I run $descendants =…
mattalxndr
  • 9,143
  • 8
  • 56
  • 87
1
vote
0 answers

Symfony DI Component - How to make some services public and accessible by interface classname

Using DI as a standalone component in the small part of the codebase I want to make some services visible outside this part and accessible as by interface class name. As I know, I should use a container for this. So when old part of the code (that…