forked from symfony/recipes-contrib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added recipe for FOSUserBundle (symfony#345 symfony#270)
- Loading branch information
1 parent
4c9ad8e
commit 78221a4
Showing
5 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
62 changes: 62 additions & 0 deletions
62
friendsofsymfony/user-bundle/2.0/config/packages/fos_user.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
fos_user: | ||
resource: "@FOSUserBundle/Resources/config/routing/all.xml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
public function __construct() | ||
{ | ||
parent::__construct(); | ||
// your own logic | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
friendsofsymfony/user-bundle/2.0/src/Repository/UserRepository.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
{ | ||
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() | ||
; | ||
} | ||
*/ | ||
} |