symfony

Attempted to load class “WebProfilerBundle” from namespace “Symfony\Bundle\WebProfilerBundle” when deploying on Heroku using development dependencies

旧街凉风 提交于 2020-12-31 07:38:22
问题 We have a Symfony 4.3 web application hosted on Heroku. This is a new setup and we never managed to have the dev mode to work correctly . There are plenty of similar issues online but none fixes the exact symptoms we are facing here. The project was created with a command line: composer create-project symfony/website-skeleton appName Let me clarify that: we do not want to change from "dev" to "prod" We need to be able to use the application in dev mode in order to take advantage of error

How to extend session cookie lifetime in Symfony?

旧街凉风 提交于 2020-12-29 12:01:37
问题 On accessing session data on the server side, its modified_time gets set, therefore extending its expiration time into the future. However, this does not happen for PHPSESSID cookie. While session data expiration on the server side is extended, the cookie expiration is not. If the cookie expires, the user will lose his session - he will have no session ID to give when sending a request. Is there any way to tell Symfony\Component\HttpFoundation\Session\Session to extend the cookie expiration

Symfony 4 extremely slow on windows

爷,独闯天下 提交于 2020-12-29 03:22:51
问题 I've used Symfony on Windows 10 for my projects for a few years (SF2, SF3), and I recently moved to Symfony 4 to build a new project but performances are catastrophic. Symfony initialization time takes from 5 to 25s, as in this example It is the same with console: for example a cache:clear can last 1 minute. I searched for similar problems and issues in Symfony doc and forums, and I've tested recommended optimizations (increase some values for ​​opcache , enable APCu , disable xdebug , add

Symfony 4 extremely slow on windows

别说谁变了你拦得住时间么 提交于 2020-12-29 03:20:14
问题 I've used Symfony on Windows 10 for my projects for a few years (SF2, SF3), and I recently moved to Symfony 4 to build a new project but performances are catastrophic. Symfony initialization time takes from 5 to 25s, as in this example It is the same with console: for example a cache:clear can last 1 minute. I searched for similar problems and issues in Symfony doc and forums, and I've tested recommended optimizations (increase some values for ​​opcache , enable APCu , disable xdebug , add

Symfony 4 extremely slow on windows

蓝咒 提交于 2020-12-29 03:20:06
问题 I've used Symfony on Windows 10 for my projects for a few years (SF2, SF3), and I recently moved to Symfony 4 to build a new project but performances are catastrophic. Symfony initialization time takes from 5 to 25s, as in this example It is the same with console: for example a cache:clear can last 1 minute. I searched for similar problems and issues in Symfony doc and forums, and I've tested recommended optimizations (increase some values for ​​opcache , enable APCu , disable xdebug , add

How to Simulate 500 Error in Symfony 2

孤街醉人 提交于 2020-12-29 02:41:53
问题 I am wondering how would I simulate a 500 error in Symfony 2. I have been reading this post where Raise suggests throwing an exception throw new sfException('Testing the 500 error'); in Symfony 1.4. I have been placing this code in my \store\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\Controller\ExceptionController.php but I get the fatal error Class 'Symfony\Bundle\TwigBundle\Controller\sfException' not found in /home/notroot/www/store/vendor/symfony/symfony/src/Symfony/Bundle

PHP getenv always returns false

一世执手 提交于 2020-12-27 06:36:35
问题 The getenv() always returns false. I am using Symfony dotenv library and loading my variables from a .env file in the root of my project. use Symfony\Component\Dotenv\Dotenv; use Symfony\Component\Dotenv\Exception\PathException; if (!getenv('APP_ENV')) { try { (new Dotenv())->load(__DIR__ . '/../.env'); } catch (PathException $ex) { echo $ex->getMessage(); exit(1); } } var_dump(getenv('APP_ENV')); // bool(false) But when I dump the super global I can see my variables var_dump($_ENV); // array

Symfony form validation of decimal field

99封情书 提交于 2020-12-16 07:08:06
问题 I am trying to use the Assert validation rule with decimal and it fails with error. Here is my form $builder->add('cinp_number', 'number', array( 'required' => false, )); Here is my Entity /** * @Assert\Type(type="decimal") * @var decimal */ private $cinp_number; This is the error when submiting form with string value as input: Warning: NumberFormatter::parse(): Number parsing failed LOG Message: request.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\ContextErrorException:

Symfony Form with Doctrine Class Table Inheritance (CTI)

最后都变了- 提交于 2020-12-15 05:32:20
问题 In a previous question I ask how to handle large forms, outcome was Single Table Inheritance (STI) or CTI, Inheritance mapping. I've has chosen for CTI. Now i'm dealing how to create the form with CTI. A quick overview what kind or relation there are. Each inspection could have one or more surfaces . Each surface consists of many sub entities, like: surface_leakage , surface_tension or surface_slope . As you could see surface has the CTI with sub entities. Some fields overlap (put them in

Symfony: How to dynamically add Lines to a Poll?

爷,独闯天下 提交于 2020-12-15 04:57:05
问题 I created a Symfony Poll-Bundle which has the Entitys Campaign->Block->Line->Field->PollResult. So i have a CollectionType CampaignType which consists of many blocks. Block is also a CollectionType and consists of many Lines. One Line consist of many Fields and every Field has one PollResult which holds the Answer of the user who filled out the campaign. So the Campaign could be a Covid-19 Campaign with a block in it called Symptoms, which has Lines for the different Symptoms. Each Line has a