-
-
Notifications
You must be signed in to change notification settings - Fork 656
Added recipe for FOSUserBundle (#345 #270) #363
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fos_user: | ||
resource: "@FOSUserBundle/Resources/config/routing/all.xml" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"bundles": { | ||
"FOS\\UserBundle\\FOSUserBundle": ["all"] | ||
}, | ||
"copy-from-recipe": { | ||
"config/": "%CONFIG_DIR%/", | ||
"src/": "%SRC_DIR%/" | ||
}, | ||
"env": { | ||
"MAILER_SENDER_ADDRESS": "[email protected]", | ||
"MAILER_SENDER_NAME": "John Doe" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use FOS\UserBundle\Model\User as BaseUser; | ||
|
||
/** | ||
* @ORM\Entity(repositoryClass="App\Repository\UserRepository") | ||
* @ORM\Table(name="fos_user") | ||
*/ | ||
class User extends BaseUser | ||
{ | ||
/** | ||
* @ORM\Id() | ||
* @ORM\GeneratedValue() | ||
* @ORM\Column(type="integer") | ||
*/ | ||
protected $id; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer |
||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe write a comment saying that this line is important. |
||
// your own logic | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
namespace App\Repository; | ||
|
||
use App\Entity\User; | ||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | ||
use Symfony\Bridge\Doctrine\RegistryInterface; | ||
|
||
/** | ||
* @method User|null find($id, $lockMode = null, $lockVersion = null) | ||
* @method User|null findOneBy(array $criteria, array $orderBy = null) | ||
* @method User[] findAll() | ||
* @method User[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | ||
*/ | ||
class UserRepository extends ServiceEntityRepository | ||
{ | ||
public function __construct(RegistryInterface $registry) | ||
{ | ||
parent::__construct($registry, User::class); | ||
} | ||
|
||
// /** | ||
// * @return User[] Returns an array of User objects | ||
// */ | ||
/* | ||
public function findByExampleField($value) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be removed. I would prefer to see a link to the docs. |
||
{ | ||
return $this->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() | ||
; | ||
} | ||
*/ | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comments like this.