symfony-2.2

Symfony 2 Twig |date() not working?

爷,独闯天下 提交于 2019-12-11 08:12:18
问题 i have a little problem and I really don't know why. I am printing a datetime variable in twig with |date() but it is allways printing the actual time. for Debugging I put the following Code in my Template: <pre> {% debug entity.getCreatedAt|date("d.m.Y H:i:s") %} {% debug entity.getCreatedAt|raw %} {% debug entity.CreatedAt|raw %} {% debug entity.CreatedAt|date("d.m.Y H:i:s") %} My Variable is called CreatedAt so normally I should get the correct output with entity.CreatedAt|date("d.m.Y H:i

Symfony 2.2 white/blank screen in prod (another one)

泪湿孤枕 提交于 2019-12-11 04:15:25
问题 I updated a few files on my server, remove the cache-dir and had to recognize, that I receive a white page, after refreshing I was able to login and then got a blank screen. I tried this localhost and got the same. app_dev works well. Googleing around I fount this change in the app.php $kernel = new AppKernel('prod', true); // >> before: new AppKernel('prod', false); This helped, since I had removed the cache again. Warming the cache didn't help either: php console cache:clear --env=prod --no

Symfony 2.2 extend ExceptionController

試著忘記壹切 提交于 2019-12-10 03:12:32
问题 This question is related to the following change (part of Symfony 2.2 release): Part 1 In pre-2.2 Symfony, I was overriding ExceptionController to display some custom error pages. I did that via: parameters: twig.exception_listener.controller: My\CustomBundle\CustomExceptionController::showAction Now, after upgrading to 2.2, I can no longer do that, because an exception is thrown while generating an exception (no pun intended): ExceptionController::__construct() must be an instance of Twig

Symfony2 demo testing issues

蹲街弑〆低调 提交于 2019-12-09 08:58:59
问题 I just installed the last version of phpunit and when I run the demo test with: bin/phpunit src/Acme/DemoBundle/Tests/ I get this problems: 1) Acme\DemoBundle\Tests\Controller\DemoControllerTest::testIndex RuntimeException: Unable to guess the Kernel directory. and the lines where the kernel is citated Any ideas about why does this DEMO TEST doesn't works? 回答1: Try runing bin/phpunit -c app/ src/Acme/DemoBundle/Tests/ from your project root directory. There is app/phpunit.xml.dist phpunit

Container Dependecy Injection not working in Fixtures after upgrading symfony 2.0 to 2.1/2.2

别来无恙 提交于 2019-12-08 04:18:36
问题 I upgraded a project from Symfony 2.0 to 2.1. After that my tests stopped working. The problem is that I use fixtures which implement the ContainerAware interface. Now after the upgrade the setContainer() method does not get called anymore. I tried upgrading further to 2.2. The problem still persists. composer.json: { "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "":

Adding a form error in an EventListener

◇◆丶佛笑我妖孽 提交于 2019-12-07 18:16:31
问题 I have a Symfony 2.2 based application with a form that has a field that is only required based on another field in the form. I bound an EventListener to catch when the form is submitted so I can verify if the 'required' field is actually not needed when the form is submitted. I've noticed that I can't set a FormError inside the PRE_BIND form event. Doing so doesn't show the error, but if I bind to the BIND event listener then the form error is displayed properly but I don't want to wait

JMSSerializer + forms/arrays

风流意气都作罢 提交于 2019-12-07 13:14:06
问题 I'm rather newcomer into SF2 community, so please, take it easy ;) I've faced an issue with JMSSerializerBundle and forms/arrays. I've spent two days trying to figure it out myself, without any success and I've decided to post this to the Group. I'm building a simple test application that will allow me to understand how the stuff works. Now it's time for API. I'm using FOSRestBundle, works perfectly. My whole "application" is working perfectly (development was really fast and effective), I've

Container Dependecy Injection not working in Fixtures after upgrading symfony 2.0 to 2.1/2.2

爱⌒轻易说出口 提交于 2019-12-07 12:34:24
I upgraded a project from Symfony 2.0 to 2.1. After that my tests stopped working. The problem is that I use fixtures which implement the ContainerAware interface. Now after the upgrade the setContainer() method does not get called anymore. I tried upgrading further to 2.2. The problem still persists. composer.json: { "name": "symfony/framework-standard-edition", "license": "MIT", "type": "project", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.2.*", "doctrine/orm": ">=2.2.3,<2.5-dev

Stop validation on first error flag in Symfony2?

寵の児 提交于 2019-12-07 05:35:46
问题 I'm searching for informations if there is some kind of flag/option that force symfony2 validation stop on first error in validation chain. For example I have three validators on my email field: email: - NotBlank: { groups: [ send_activation_email ] } - Length: { min: 6, max: 80, charset: UTF-8, groups: [ send_activation_email ] } - Email: { groups: [ send_activation_email ] } I want to stop validation after first error. How can I achieve that? I read similar questions: Symfony2 : Validation

Symfony2 custom authentication provider bad credentials

只愿长相守 提交于 2019-12-06 14:51:32
问题 I'm implementing a custom authentication provider for using an external api following roughly the cookbook on the symfony website. It works almost everything correctly, the listener listens the login form properly, then it calls the authenticate function which returns the authenticated token, the problem is that even if i set a authenticated token to the securityContextInterface, the system returns to the login page with wrong credentials. Under the code i've used What could it be? security