Skip to content
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

WIP: Add fosuserbundle recipe. #343

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
fos_user:
db_driver: orm
user_class: App\Entity\User
firewall_name: main
service:
mailer: 'fos_user.mailer.noop'
from_email:
address: '%env(EMAIL_FROM_ADDRESS)%'
sender_name: '%env(EMAIL_FROM_NAME)%'
2 changes: 2 additions & 0 deletions friendsofsymfony/user-bundle/2.1/config/routes/fos_user.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fos_user:
resource: '@FOSUserBundle/Resources/config/routing/all.xml'
13 changes: 13 additions & 0 deletions friendsofsymfony/user-bundle/2.1/manifest.json
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": {
"EMAIL_FROM_ADDRESS": "[email protected]",
"EMAIL_FROM_NAME": "admin"
}
}
21 changes: 21 additions & 0 deletions friendsofsymfony/user-bundle/2.1/src/Entity/User.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace App\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
* @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;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be private?


}
28 changes: 28 additions & 0 deletions friendsofsymfony/user-bundle/2.1/src/Repository/UserRepository.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace App\Repository;

use App\Entity\User;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;

class UserRepository extends ServiceEntityRepository
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need a UserRepository

{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, User::class);
}

/*
public function findBySomething($value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use commented code like this

{
return $this->createQueryBuilder('u')
->where('u.something = :value')->setParameter('value', $value)
->orderBy('u.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/
}