symfony4

How to set initial data (not test data) in Symfony with doctrine ORM

≡放荡痞女 提交于 2020-06-22 22:33:08
问题 I am new to learning Symfony, (Symfony 4.1.6) and can't figure this out. I have a database, and it contains a lot of tables for populating html select type inputs. they are in the database to ensure Foreign Key constraints in other records. Is there a way to "add" this data to the database and track it? (via git) or should I resort to keeping an SQL file of just the "inserts" I have looked at Fixtures but they seem to be mostly for dummy data. I want to insert real data. What is the "best

Symfony4 MakerBundle Own Crud Maker

若如初见. 提交于 2020-06-17 02:46:51
问题 I want to customize the boilerplate code of the new makerbundle crud maker. There is no simple overwriting the templates as it was in SensioGeneratorBundle. I tried to generate a custom MyMakeCrud based on the original code - but i struggle about the injected DoctrineEntityHelper $entityHelper. Cannot autowire service "App\Maker\MakeMyCrud": argument "$entityHelper" of method "__construct()" references class "Symfony\Bundle\MakerBundle\Doctri ne\DoctrineEntityHelper" but no such service

How to extend LdapUserProvider and use a custom LDAP user provider in Symfony?

冷暖自知 提交于 2020-05-29 08:27:08
问题 I'm struggeling to replace the LdapUserProvider. I created my own provider (App\Security\MyLdapUserProvider based on LdapUserProvider but retrieves more information) and my own UserInterface (App\Security\MyUser) with more attributes to store the data. In the end I want to retrieve the groups and the displayName of the user. Here is my config: services.yaml: # add more service definitions when explicit configuration is needed # please note that last definitions always *replace* previous ones

Symfony 4 - route : “The requested URL was not found on this server”

六眼飞鱼酱① 提交于 2020-05-16 01:56:30
问题 this is my first post so i'll try to be understandable. I am starting with symfony, and there is a problem i can't resolve alone. This is my controller, and I am working with WAMP. When my Url is "mysite.local", it work normally, and it show me what it should (thanks to the home() function). But when my Url is "mysite.local/hello", i have the following error. Not Found The requested URL was not found on this server. Apache/2.4.41 (Win64) PHP/7.4.0 Server at mysite.local Port 80 I guess this

Symfony Doctrine ORM CLI Font/Colors not working?

孤者浪人 提交于 2020-05-15 02:16:46
问题 I have been looking online to see how to fix this, and have been unsuccessful. I've actually had this issue for over a year now and have simply just ignored it. Now that I'm doing more doctrine ORM stuff in my Symfony 4.1 project, I would like to know if anyone knows how to fix the font/colors on my Windows 10 machine? Command Line tools: * Powershell - Doesn't show the colors correctly * Command Prompt - Doesn't show the colors correctly * Git CMD - Doesn't show the colors correctly This is

How write a Symfony Flex recipe for a new bundle?

江枫思渺然 提交于 2020-04-28 09:01:34
问题 I tried to find any documentation about using Symfony Flex but so far no luck. Almost all docs point to installing a bundle that uses symfony Flex, not how to create a bundle that is using it. I even tried to reverse engineer some of the packages but again, no luck. My goal is to generate a default configuration file for my bundle in config/packages/my_bundle.yaml . What I need to know is where do I need to put it and what env variables (if any) will I have available? 回答1: What is a Flex

How to add Fontawesome 5 to Symfony 4 using Webpack Encore

自闭症网瘾萝莉.ら 提交于 2020-03-17 06:44:05
问题 I want to add Font Awesome 5 to my Symfony 4 project, this is what I did : I added font awesome to my project using yarn : yarn add --dev @fortawesome/fontawesome-free I imported font awesome in my main scss file (assets/css/app.scss) : @import '~@fortawesome/fontawesome-free/scss/fontawesome'; my webpack encore configuration include my scss and js files : .addEntry('js/app', './assets/js/app.js') .addStyleEntry('css/app', './assets/css/app.scss') I compiled : ./node_modules/.bin/encore dev

How to disable “verify_peer” with Symfony Mailer component?

南楼画角 提交于 2020-03-14 11:39:40
问题 I'm configuring a mail server (postfix), with a self signed certificate, and it seems this self signed certificate is a problem for the Symfony Mailer component. On Swiftmailer, using some configuration such as: transport: stream_options: ssl: allow_self_signed: true or stream_options: ssl: verify_peer: false verify_peer_name: false might fix it, but I can't find a way to do that on mailer (I want to use the YAML configuration files if possible). 回答1: This option will been enabled when this

How to disable “verify_peer” with Symfony Mailer component?

◇◆丶佛笑我妖孽 提交于 2020-03-14 11:38:58
问题 I'm configuring a mail server (postfix), with a self signed certificate, and it seems this self signed certificate is a problem for the Symfony Mailer component. On Swiftmailer, using some configuration such as: transport: stream_options: ssl: allow_self_signed: true or stream_options: ssl: verify_peer: false verify_peer_name: false might fix it, but I can't find a way to do that on mailer (I want to use the YAML configuration files if possible). 回答1: This option will been enabled when this

How to translate symfony form error messages?

巧了我就是萌 提交于 2020-02-25 06:18:45
问题 for symfony standalone translation component I use: $translator = new Translator('fr_FR'); $translator->addLoader('php', new \Symfony\Component\Translation\Loader\PhpFileLoader()); $translator->addResource('php', ROOT.'/translations/messages.fr.php', 'fr_FR'); $twig->addExtension(new TranslationExtension($translator)); It is working fine to translate symfony form labels. To translate symfony form constraint errors I use: ->add('firstname', TextType::class, [ 'constraints' => [new Assert