From fc0823710bbae75ae044e2e4f54afa9b4ab2892a Mon Sep 17 00:00:00 2001 From: umpirsky Date: Fri, 1 Feb 2013 11:15:27 +0100 Subject: [PATCH] Initial FOSUserBundle integration --- DataFixtures/ORM/LoadUsersData.php | 68 ++++++++++++++++++++++++++ Entity/User.php | 23 +++++++++ Resources/config/doctrine/User.orm.xml | 14 ++++++ 3 files changed, 105 insertions(+) create mode 100644 DataFixtures/ORM/LoadUsersData.php create mode 100644 Entity/User.php create mode 100644 Resources/config/doctrine/User.orm.xml diff --git a/DataFixtures/ORM/LoadUsersData.php b/DataFixtures/ORM/LoadUsersData.php new file mode 100644 index 000000000..90ba464f9 --- /dev/null +++ b/DataFixtures/ORM/LoadUsersData.php @@ -0,0 +1,68 @@ + + */ +class LoadUsersData extends DataFixture +{ + /** + * {@inheritdoc} + */ + public function load(ObjectManager $manager) + { + $user = new User(); + + $user->setUsername('administrator'); + $user->setEmail('administrator@example.com'); + $user->setPlainPassword('abrakadabra'); + $user->setEnabled(true); + $user->setRoles(array('ROLE_SYLIUS_ADMIN')); + + $manager->persist($user); + $manager->flush(); + + $this->setReference('User-Administrator', $user); + + for ($i = 1; $i <= 15; $i++) { + $user = new User(); + + $username = $this->faker->username; + + $user->setUsername($username); + $user->setEmail($username.'@example.com'); + $user->setPlainPassword($username); + $user->setEnabled($this->faker->boolean()); + + $manager->persist($user); + + $this->setReference('User-'.$i, $user); + } + + $manager->flush(); + + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 1; + } +} diff --git a/Entity/User.php b/Entity/User.php new file mode 100644 index 000000000..a145eeaa4 --- /dev/null +++ b/Entity/User.php @@ -0,0 +1,23 @@ + + */ +class User extends BaseUser +{ +} diff --git a/Resources/config/doctrine/User.orm.xml b/Resources/config/doctrine/User.orm.xml new file mode 100644 index 000000000..5c8010990 --- /dev/null +++ b/Resources/config/doctrine/User.orm.xml @@ -0,0 +1,14 @@ + + + + + + + + + + +