This file contains hidden or 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
| <?php | |
| namespace MyCompany\BlogBundle\Form; | |
| use Symfony\Component\Form\AbstractType; | |
| use Symfony\Component\Form\FormBuilder; | |
| class UserType extends AbstractType | |
| { | |
| public function buildForm(FormBuilder $builder, array $options) |
This file contains hidden or 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
| <?php | |
| namespace MyCompany\BlogBundle\Entity; | |
| use Doctrine\ORM\Mapping as ORM; | |
| /* Include the required validators */ | |
| use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | |
| use Symfony\Component\Validator\Constraints as Assert; | |
This file contains hidden or 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
| <h1>Users</h1> | |
| {% if users|length == 0 %} | |
| {# No users to display... #} | |
| <p>Could not find any users :(</p> | |
| {% else %} | |
| <table> | |
| <thead> | |
| <td>Username</td> | |
| <td>Email address</td> | |
| <td>Password</td> |
This file contains hidden or 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
| <form action="{{ path('user_create') }}" method="post" {{ form_enctype(form) }}> | |
| {{ form_widget(form) }} | |
| <input type="submit" /> | |
| </form> |
This file contains hidden or 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
| <?php | |
| namespace MyCompany\BlogBundle\Entity; | |
| use Doctrine\ORM\Mapping as ORM; | |
| // Add this so that we load the UserInterface class | |
| use Symfony\Component\Security\Core\User\UserInterface; | |
| class User implements UserInterface // Make sure we implement UserInterface |
This file contains hidden or 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
| <?php | |
| namespace MyCompany\BlogBundle\Entity; | |
| use Doctrine\ORM\EntityRepository; | |
| // Make sure we include UserProviderInterface | |
| use Symfony\Component\Security\Core\User\UserProviderInterface; | |
| use Symfony\Component\Security\Core\Exception\UsernameNotFoundException; | |
| use Symfony\Component\Security\Core\Exception\UnsupportedUserException; |
This file contains hidden or 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
| <?php | |
| interface UserInterface | |
| { | |
| /** | |
| * Returns an array of strings, where each string is a role that this user has. | |
| * | |
| * @return Role[] An array containing the roles this user has | |
| */ | |
| function getRoles(); |
This file contains hidden or 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
| <?php | |
| interface UserProviderInterface | |
| { | |
| /** | |
| * Loads the user object for the given username. | |
| * | |
| * @param string $username The username | |
| * @return UserInterface | |
| * @throws UsernameNotFoundException If the user is not found | |
| */ |
This file contains hidden or 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
| { | |
| "require": { | |
| "symfony/class-loader": "2.1.*" | |
| } | |
| } |
This file contains hidden or 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
| <?php | |
| use Symfony\Component\HttpFoundation\Request; | |
| use Symfony\Component\HttpFoundation\Response; | |
| /* Using the HTTP Foundation class */ | |
| $request = Request::createFromGlobals(); | |
| $input = $request->get('name', 'World'); | |
| $response = new Response('Hello ' . $input); | |
| $response->send(); |