From 78221a405ac4879396849990e602b2cb7fa883ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Bu=C3=9Fmann?= Date: Wed, 16 May 2018 22:27:00 +0200 Subject: [PATCH] Added recipe for FOSUserBundle (#345 #270) --- .../2.0/config/packages/fos_user.yaml | 62 +++++++++++++++++++ .../2.0/config/routes/fos_user.yaml | 2 + .../user-bundle/2.0/manifest.json | 13 ++++ .../user-bundle/2.0/src/Entity/User.php | 26 ++++++++ .../2.0/src/Repository/UserRepository.php | 50 +++++++++++++++ 5 files changed, 153 insertions(+) create mode 100644 friendsofsymfony/user-bundle/2.0/config/packages/fos_user.yaml create mode 100644 friendsofsymfony/user-bundle/2.0/config/routes/fos_user.yaml create mode 100644 friendsofsymfony/user-bundle/2.0/manifest.json create mode 100644 friendsofsymfony/user-bundle/2.0/src/Entity/User.php create mode 100644 friendsofsymfony/user-bundle/2.0/src/Repository/UserRepository.php diff --git a/friendsofsymfony/user-bundle/2.0/config/packages/fos_user.yaml b/friendsofsymfony/user-bundle/2.0/config/packages/fos_user.yaml new file mode 100644 index 000000000..5c6570c69 --- /dev/null +++ b/friendsofsymfony/user-bundle/2.0/config/packages/fos_user.yaml @@ -0,0 +1,62 @@ +fos_user: + db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel' + firewall_name: main + user_class: AppBundle\Entity\User +# use_listener: true +# use_username_form_type: true +# model_manager_name: null # change it to the name of your entity/document manager if you don't want to use the default one. + from_email: + address: "%env(MAILER_SENDER_ADDRESS)%" + sender_name: "%env(MAILER_SENDER_NAME)%" +# profile: +# form: +# type: fos_user_profile +# handler: fos_user.profile.form.handler.default +# name: fos_user_profile_form +# validation_groups: [Profile, Default] +# change_password: +# form: +# type: fos_user_change_password +# handler: fos_user.change_password.form.handler.default +# name: fos_user_change_password_form +# validation_groups: [ChangePassword, Default] +# registration: +# confirmation: +# from_email: # Use this node only if you don't want the global email address for the confirmation email +# address: ... +# sender_name: ... +# enabled: false # change to true for required email confirmation +# template: FOSUserBundle:Registration:email.txt.twig +# form: +# type: fos_user_registration +# handler: fos_user.registration.form.handler.default +# name: fos_user_registration_form +# validation_groups: [Registration, Default] +# resetting: +# token_ttl: 86400 +# email: +# from_email: # Use this node only if you don't want the global email address for the resetting email +# address: ... +# sender_name: ... +# template: FOSUserBundle:Resetting:email.txt.twig +# form: +# type: fos_user_resetting +# handler: fos_user.resetting.form.handler.default +# name: fos_user_resetting_form +# validation_groups: [ResetPassword, Default] +# service: +# mailer: fos_user.mailer.default +# email_canonicalizer: fos_user.util.canonicalizer.default +# username_canonicalizer: fos_user.util.canonicalizer.default +# token_generator: fos_user.util.token_generator.default +# user_manager: fos_user.user_manager.default +# template: +# engine: twig +# group: +# group_class: ~ # Required when using groups +# group_manager: fos_user.group_manager.default +# form: +# type: fos_user_group +# handler: fos_user.group.form.handler.default +# name: fos_user_group_form +# validation_groups: [Registration, Default] diff --git a/friendsofsymfony/user-bundle/2.0/config/routes/fos_user.yaml b/friendsofsymfony/user-bundle/2.0/config/routes/fos_user.yaml new file mode 100644 index 000000000..27b7ca31b --- /dev/null +++ b/friendsofsymfony/user-bundle/2.0/config/routes/fos_user.yaml @@ -0,0 +1,2 @@ +fos_user: + resource: "@FOSUserBundle/Resources/config/routing/all.xml" diff --git a/friendsofsymfony/user-bundle/2.0/manifest.json b/friendsofsymfony/user-bundle/2.0/manifest.json new file mode 100644 index 000000000..39de053d5 --- /dev/null +++ b/friendsofsymfony/user-bundle/2.0/manifest.json @@ -0,0 +1,13 @@ +{ + "bundles": { + "FOS\\UserBundle\\FOSUserBundle": ["all"] + }, + "copy-from-recipe": { + "config/": "%CONFIG_DIR%/", + "src/": "%SRC_DIR%/" + }, + "env": { + "MAILER_SENDER_ADDRESS": "john@doe.com", + "MAILER_SENDER_NAME": "John Doe" + } +} diff --git a/friendsofsymfony/user-bundle/2.0/src/Entity/User.php b/friendsofsymfony/user-bundle/2.0/src/Entity/User.php new file mode 100644 index 000000000..adbf8d1f8 --- /dev/null +++ b/friendsofsymfony/user-bundle/2.0/src/Entity/User.php @@ -0,0 +1,26 @@ +createQueryBuilder('u') + ->andWhere('u.exampleField = :val') + ->setParameter('val', $value) + ->orderBy('u.id', 'ASC') + ->setMaxResults(10) + ->getQuery() + ->getResult() + ; + } + */ + + /* + public function findOneBySomeField($value): ?User + { + return $this->createQueryBuilder('u') + ->andWhere('u.exampleField = :val') + ->setParameter('val', $value) + ->getQuery() + ->getOneOrNullResult() + ; + } + */ +}