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
40
votes
2 answers

How to create custom event in symfony2

I want to create custom events called user_logged so that i can attach my listeners to those events. I want to execute few functions whenever user has logged in.
Mirage
  • 30,868
  • 62
  • 166
  • 261
26
votes
1 answer

Generating a PHAR for a simple application

I'm experimenting in building CLI tools using the Symfony2 console library. I've got something basic working and now I want to package it as a phar. I've read a few examples but the ones I've seen are very simple (3 files, no namespaces, etc). In my…
Bendihossan
  • 2,407
  • 5
  • 22
  • 25
8
votes
4 answers

Symfony Dependency Injection inject new instance of class

I'm using symfony/dependency-injection component (note: not using the full stack framework) When registering a new service i want to inject in the constructor a new instance of a class. Example: $container->register('session',…
spdionis
  • 307
  • 1
  • 4
  • 11
7
votes
5 answers

Why I can't get Symfony Finder like a service?

I use Symfony Standard Edition and try to get Symfony Finder component like a service, but not found it. To use the Finder, I need to create it manually like: $finder = new Symfony\Component\Finder\Finder(); Why I can't get it from service…
7
votes
8 answers

Laravel 4 Queue:listen times out

I ran php artisan queue:listen and after about 27 minutes, it stops processing any more jobs. In my error log, I see the error: exception 'Symfony\Component\Process\Exception\RuntimeException' with message 'The process timed out.' in…
Nyxynyx
  • 61,411
  • 155
  • 482
  • 830
6
votes
3 answers

How can I sort files by DESC order with Symfony Finder Component?

By default Symfony Finder Component sorts files by ASC order. //sorting by ASC order $finder->files()->in($this->getDumpPath())->sortByModifiedTime(); How can I sort files by DESC?
Victor Bocharsky
  • 11,930
  • 13
  • 58
  • 91
6
votes
4 answers

Can Goutte/Guzzle be forced into UTF-8 mode?

I'm scraping from a UTF-8 site, using Goutte, which internally uses Guzzle. The site declares a meta tag of UTF-8, thus: However, the content type header is thus: Content-Type:…
halfer
  • 19,824
  • 17
  • 99
  • 186
5
votes
2 answers

Run multiple Symfony console commands, from within a command

I have two commands defined in a Symfony console application, clean-redis-keys and clean-temp-files. I want to define a command clean that executes these two commands. How should I do this?
user2064000
5
votes
3 answers

Advanced type validation with OptionsResolver component

I need allow types that implement two interfaces (Foo and Bar), not one of them. interface Foo {}; interface Bar {}; class Foz implements Foo {}; class Baz implements Bar {}; class Foobar implements Foo, Bar {}; $resolver = new…
yceruto
  • 9,230
  • 5
  • 38
  • 65
5
votes
1 answer

Using Symfony\Console for an interactive php cli application

I want to develop an interactive command based php application, so I did some research and bumped into the Symfony\Console component. This is great, because it lets met run php script.php command --option However, the script then runs the command…
5
votes
1 answer

Translation in Validator Component

I'm currently integrating the Symfony Validator Component into a custom PHP Application. So far, everything has been working pretty nice and I can validate my User input. Now I want to translate the validation messages to another locale and have…
room13
  • 1,922
  • 1
  • 15
  • 28
4
votes
0 answers

Symfony required arguments in console comand not working

I am using Symfony's console component, in a command with 1 required option and 1 required argument. However, upon execution the option and argument are NOT required. Am I missing something? Relevant code below. protected function configure() { …
Stephane Gosselin
  • 9,030
  • 5
  • 42
  • 65
4
votes
1 answer

Doctrine standalone without cli-config.php

I want to integrate Doctrine ORM into my (non-Symfony) project. I already done this in another project and used the famous cli-config.php into the project root directory. But now, in my new project, I use the Symfony Console component and the…
4
votes
1 answer

Extending Symfony2 Controller Resolver

I am currently creating a bundle which can rename fooAction into fooAjaxAction if request is an Ajax Request. As the answer of that question says, I have to extend the controller resolver class. I have a ResourceNotFoundException if I change the…
Fabien Papet
  • 2,244
  • 2
  • 25
  • 52
3
votes
1 answer

Referencing Nested Parameters in Symfony 4 Configuration Files

I would like to be able to use nested parameters defined in one configuration file in another for examle # config/config.yaml (my custom configuration file) database: driver: pdo_mysql host: localhost user: dev password: dev …
1
2 3 4 5