symfony-2.1

Symfony 2: 404 Not Found Error when tryes to open /app_dev.php

微笑、不失礼 提交于 2019-11-30 14:44:46
问题 I am getting this error message when try to open /app_dev.php An error occurred while loading the web debug toolbar (404: Not Found). Do you want to open the profiler? When I click ok, I am getting then the error: app_dev.php/_profiler/5053258a822e1 and 404 Not found I am using nginx Thank you very much for your help. EDIT: Here is the error log: [error] 18369#0: *9 open() "/var/www/Symfony/web/app_dev.php/_wdt/5056f875afc98" failed (20: Not a directory), client: 127.0.0.1, server: symfony,

Changing locale with symfony 2.1

大城市里の小女人 提交于 2019-11-30 14:11:16
问题 Having some issue changing the locale on a symfony 2.1 website. I can't find a way to be able to change the lang without using the _locale on every routes. I know this is against the fundamental rule, but this content will for example not be indexed by engine as it is member only. Typically, I would like a simple method to be able to change the locale on the request (BC from version 2.1), or on the session, but can't figure out how to do that smoothly. I also would like to avoid the use of a

Symfony2 Route global {_locale} requirements

只谈情不闲聊 提交于 2019-11-30 13:25:43
问题 I have in my routing.yml specified the parameter _locale requirements in every single route and I think that must be something to simplify this situation. routing.yml ProjectBaseBundle_index: pattern: /{_locale} defaults: { _controller: ProjectBaseBundle:Default:index } requirements: _locale: en|es ProjectBaseBundle_privacy: pattern: /privacy/{_locale} defaults: { _controller: ProjectBaseBundle:Default:privacy } requirements: _locale: en|es ..... ProjectBaseBundle_legal: pattern: /legal/{

Symfony 2: 404 Not Found Error when tryes to open /app_dev.php

こ雲淡風輕ζ 提交于 2019-11-30 11:35:43
I am getting this error message when try to open /app_dev.php An error occurred while loading the web debug toolbar (404: Not Found). Do you want to open the profiler? When I click ok, I am getting then the error: app_dev.php/_profiler/5053258a822e1 and 404 Not found I am using nginx Thank you very much for your help. EDIT: Here is the error log: [error] 18369#0: *9 open() "/var/www/Symfony/web/app_dev.php/_wdt/5056f875afc98" failed (20: Not a directory), client: 127.0.0.1, server: symfony, request: "GET /app_dev.php/_wdt/5056f875afc98 HTTP/1.1", host: "symfony", referrer: "http://symfony/app

Customize form field rendering

爱⌒轻易说出口 提交于 2019-11-30 07:27:00
I would like to customize the rendering of a form field in the edit page from sonata admin bundle to include an applet that uses the text content of a field. I know that I have to edit the configureFormFields function in the admin class, but I need to know 3 things: What is the syntax to provide a field form template Where to put the template file ( which directory ) What the template have to looks like. user1254498 Found a solution What i have done is: Created a field type, lets call it myfieldType in myCompany\myBundle\Form\Type\myfieldType.php namespace myCompany\myBundle\Form\Type; use

How do I add an unbound field to a form in Symfony which is otherwise bound to an entity?

梦想的初衷 提交于 2019-11-30 06:10:46
Maybe I'm missing the obvious but how do I (or can I) add an extra "unbound" field to a Symfony form that is otherwise bound to an entity? Let's say I have an entity with fields first_name and last_name . I do the typical thing in my form class buildForm method. $builder ->add('first_name') ->add('last_name') ; and this in my controller: $editForm = $this->createForm(new MyType(), $entity); That works nicely but I'd like to add another text box, let's call it "extra", and receive the value in the POST action. If I do $builder->add('extra')‍ , it complains that NoSuchPropertyException in

Troubleshooting “require_once(../bootstrap.php.cache): failed to open stream: No such file or directory”

强颜欢笑 提交于 2019-11-30 04:41:26
I am trying to redeploy a Symfony 2.1x project I have been working on and app_dev.php is failing because it can't find app/bootstrap.php.cache . This file is omitted from the project's git repository because I used Symfony2's recommend .gitignore file: # .gitignore /app/bootstrap* Am I correct in thinking that app/bootstrap.php.cache is generated during the $ php composer.phar install process? If this is the case then I will include for you my composer.json : // composer.json { "name": "symfony/framework-standard-edition", "description": "The \"Symfony Standard Edition\" distribution",

How to avoid composer discard changes message

纵然是瞬间 提交于 2019-11-30 04:32:18
I'm updating symfony verdors via composer. I always do it using: php composer.phar update But recent version of composer, before update each package show a message like this: - Updating doctrine/data-fixtures dev-master (a95d783 => a28b6bd) The package has modified files: M .gitignore M .gitmodules M LICENSE M README.md M UPGRADE M composer.json M lib/Doctrine/Common/DataFixtures/AbstractFixture.php M lib/Doctrine/Common/DataFixtures/DependentFixtureInterface.php M lib/Doctrine/Common/DataFixtures/Event/Listener/MongoDBReferenceListener.php M lib/Doctrine/Common/DataFixtures/Event/Listener

Get old data in preUpdate Sonata Admin Bundle

故事扮演 提交于 2019-11-30 03:18:58
问题 I have a product entity and it has an images field that store the images names from the product but the images names depends of a part_number field that is unique, so if the user make a mistake in the part number and he wants to edit it then I also have to change the images names I tried this but it does not works: // class ProductsAdmin extends Admin public function preUpdate($product) { $old_product = $this->getSubject(); if ($old_product->getPartNumber() != $product->getPartNumber) { //

composer.json fails to resolve installable set of package

蓝咒 提交于 2019-11-29 15:31:18
问题 I can't install stof/doctrine-extensions-bundle with my Composer. I'm using Symfony2.1.9 version and a lot of problems are shown. The first one is: the requested package stof/doctrine-extensions-bundle 1.1.* could not be found. This is my composer.json file: { "name": "symfony/framework-standard-edition", "description": "The \"Symfony Standard Edition\" distribution", "autoload": { "psr-0": { "": "src/" } }, "require": { "php": ">=5.3.3", "symfony/symfony": "2.1.*", "doctrine/orm": ">=2.2.3,