symfony4

Symfony 4 / Webpack Encore : jQuery doesn't work

笑着哭i 提交于 2019-12-10 14:54:19
问题 jQuery doesn't work and I can't use my bootstrap dropdown, custom javascript... After a npm run dev (or npm run build ), app.js file is well created and loads in the browser. Compilation is done without any error. I tried to enable .autoProvidejQuery() then npm run dev / npm run build , but nothing changes. I am using Symfony 4.1.6 Solution found Change .enableSingleRuntimeChunk() to .disableSingleRuntimeChunk() in webpack.config.js If you just comment on the line, it works but you have a

Route is in debug list but returns 404 in Symfony 4

删除回忆录丶 提交于 2019-12-10 12:45:45
问题 Ok, so I just installed latest version Symfony 4. Run the browser after installation and a nice welcome greeting shows. All good! Then I created a new controller using make:controller . I named this controller Client and is using Annotations, same with the other Default Controller. I configured the routing as follows: /** * @Route("/client", name="client") */ public function index() { // replace this line with your own code! return $this->render('@Maker/demoPage.html.twig', [ 'path' => str

Symfony 4 Production Mode ErrorHandling Pages Memory Exhausted

≯℡__Kan透↙ 提交于 2019-12-10 12:44:21
问题 I set my project to prod mode in .env and everything aside from the custom error pages seem to work. I have this as my 404 twig template: {# templates/bundles/TwigBundle/Exception/error404.html.twig #} {% include 'builder/layout/header.html.twig' with {'title': '404'} %} <img src="{{ assets('img/not-found.jpeg') }}" class="img-responsive" id="error-not-found-img" /> <div class="http-error-msg-container"> <h1>404! Page Not Found</h1> <p>Don't despair, go back to <a href="{{ path('dashboard') }

Symfony 4 Doctrine not working from console [2002] No such file or directory

▼魔方 西西 提交于 2019-12-10 10:35:30
问题 I´m working with symfony 4 and this error ocurr when runnning doctrine console commands: In AbstractMySQLDriver.php line 108: An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory I think this is because there´s something wrong with the connection but when I run the application it has access to the database without errors, so I can not imagine what is wrong with the connection. I was able to continue working by creating manually the database and using php bin

Symfony 4 app works with Docker Compose but breaks with Docker Swarm (no login, profiler broken)

孤人 提交于 2019-12-10 10:28:59
问题 I'm using Docker Compose locally with: app container: Nginx & PHP-FPM with a Symfony 4 app PostgreSQL container Redis container It works great locally but when deployed to the development Docker Swarm cluster, I can't login to the Symfony app. The Swarm stack is the same as local, except for PostgreSQL which is installed on its own server (not a Docker container). Using the profiler , I nearly always get the following error: Token not found Token "2df1bb" was not found in the database. When I

MariaDB 10.0 JSON type with symfony 4

北城余情 提交于 2019-12-10 10:04:19
问题 In my Linux server, I have MariaDB version 10.0 which does not support json type (supported until version 10.2) and I can't update it because it is not released in official ubuntu repository. When I run the command doctrine:migration:migrate for creating tables I get a syntax error from MariaDB for json type MariaDB: 10.0.34 - PHP: 7.1 - Symfony: 4.0.6 How do I solve this issue? 回答1: The problem is that Doctrine is expecting MariaDB 10.2+, but there have been problems getting the latest

Where do private, custom bundles live in Symfony 4?

孤街醉人 提交于 2019-12-10 09:22:50
问题 I have a number of private, custom bundles that I use in my Symfony projects. Under Symfony 3, they lived in a sub-directory of src: src/ DSL/ DSLLibraryBundle/ DSLTelnetBundle/ ... SiteBundle/ # (or AppBundle) Under Symfony 4, the application-specific bundle is gone and it's unclear to me where my custom bundles should live. The documentation on bundles (https://symfony.com/doc/current/bundles/best_practices.html#bundles-naming-conventions) provide no specific recommendations for placing

Download PhpSpreadsheet file without save it before

家住魔仙堡 提交于 2019-12-10 03:21:12
问题 I'm using PhpSpreadsheet to generate an Excel file in Symfony 4. My code is: $spreadsheet = $this->generateExcel($content); $writer = new Xlsx($spreadsheet); $filename = "myFile.xlsx"; $writer->save($filename); // LINE I WANT TO AVOID $response = new BinaryFileResponse($filename); $response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); $response->setContentDisposition( ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename ); But I don't

How can I override resources for Third-Party bundles in Symfony 4?

馋奶兔 提交于 2019-12-10 03:17:15
问题 I did a fresh Symfony installation by using Symfony Flex and the new skeleton belong to the next Symfony 4 directory structure. Next, I'm going to override some resources like templates, translations, etc. from an external bundle. I've tried to create all these paths for templates (to start) but nothing works: templates/EasyAdminBundle/views/... templates/Resources/EasyAdminBundle/views/... app/Resources/... (just a proof from old structure) Where should I puts my resources files to override

symfony: How to set configuration parameters files for different environments?

百般思念 提交于 2019-12-08 20:16:22
问题 How to setup a different configuration parameters file for each environment? At the moment parameters in parameters.yml are used in both dev and prod environment, but I need different parameters in order to deploy my app in prod. 回答1: You can put all the parameters used in your dev environment in a app\config\parameters_dev.yml file ( you need to create it ) and then import it in your app\config\config_dev.yml : imports: - { resource: config.yml } - { resource: parameters_dev.yml } So when