Commit 8738505c authored by Clouard Regis's avatar Clouard Regis
Browse files

Refactored DataFixtures

parent fccab39e
......@@ -7,7 +7,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class CourseFixtures extends Fixture implements DependentFixtureInterface
{
public const LUC_COURSE_REFERENCE = 'course_luc';
......
......@@ -7,7 +7,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class EventCourseFixtures extends Fixture implements DependentFixtureInterface
{
public const LUC_CHAMPIONSHIP_EVENTCOURSE_REFERENCE = 'Luc_championship_EventCourse';
......
......@@ -7,7 +7,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class EventFixtures extends Fixture implements DependentFixtureInterface
{
public const Championship_EVENT_REFERENCE = 'event_championship';
......
......@@ -7,7 +7,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class ParticipantFixtures extends Fixture implements DependentFixtureInterface
{
public const SULIAC_Championship_Participant_REFERENCE = 'Suliac_championship_participant';
......
......@@ -7,7 +7,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
// TODO
class ParticipantMakeEventCourseFixtures extends Fixture implements DependentFixtureInterface
{
public function load(ObjectManager $manager)
......
......@@ -7,7 +7,6 @@ use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
use Doctrine\Persistence\ObjectManager;
 
// TODO
class TrackFixtures extends Fixture implements DependentFixtureInterface
{
public const SULIAC_AUBIN_TRACK_REFERENCE = 'suliac_aubin_track';
......@@ -5,15 +5,15 @@ namespace App\DataFixtures;
use Doctrine\Bundle\FixturesBundle\Fixture;
use Doctrine\Persistence\ObjectManager;
use App\Entity\User;
use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
// TODO
class UserFixtures extends Fixture
{
private $encoder;
private UserPasswordHasherInterface $encoder;
public const TEST_USER_REFERENCE = 'user_test';
public function __construct(UserPasswordEncoderInterface $encoder){
public function __construct(UserPasswordHasherInterface $encoder){
$this->encoder = $encoder;
}
......@@ -22,7 +22,7 @@ class UserFixtures extends Fixture
$user = new User();
$user->setUsername("test");
$password = $this->encoder->encodePassword($user, "test");
$password = $this->encoder->hashPassword($user, "test");
$user->setPassword($password);
$user->setEmail("t@t.t");
......
......@@ -6,6 +6,7 @@ use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Persistence\ObjectManager;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Ambta\DoctrineEncryptBundle\Configuration\Encrypted;
......@@ -16,7 +17,7 @@ use Symfony\Component\Validator\Constraints as Assert;
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Table(name="user")
*/
class User implements UserInterface
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment