-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from umpirsky/feature/fos-user
Initial FOSUserBundle integration
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
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,68 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\CoreBundle\DataFixtures\ORM; | ||
|
||
use Doctrine\Common\Persistence\ObjectManager; | ||
use Sylius\Bundle\CoreBundle\Entity\User; | ||
|
||
/** | ||
* User fixtures. | ||
* | ||
* @author Paweł Jędrzejewski <[email protected]> | ||
*/ | ||
class LoadUsersData extends DataFixture | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(ObjectManager $manager) | ||
{ | ||
$user = new User(); | ||
|
||
$user->setUsername('administrator'); | ||
$user->setEmail('[email protected]'); | ||
$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; | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Sylius package. | ||
* | ||
* (c) Paweł Jędrzejewski | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sylius\Bundle\CoreBundle\Entity; | ||
|
||
use FOS\UserBundle\Entity\User as BaseUser; | ||
|
||
/** | ||
* User entity. | ||
* | ||
* @author Paweł Jędrzjewski <[email protected]> | ||
*/ | ||
class User extends BaseUser | ||
{ | ||
} |
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,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping | ||
http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd"> | ||
|
||
<entity name="Sylius\Bundle\CoreBundle\Entity\User" table="sylius_user"> | ||
<id name="id" column="id" type="integer"> | ||
<generator strategy="AUTO" /> | ||
</id> | ||
</entity> | ||
|
||
</doctrine-mapping> |