mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 12:03:14 +00:00
49 lines
1012 B
PHP
49 lines
1012 B
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of Phraseanet
|
|
*
|
|
* (c) 2005-2013 Alchemy
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace PhraseaFixture\User;
|
|
|
|
use Doctrine\Common\DataFixtures\FixtureInterface;
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
use Doctrine\Common\Persistence\ObjectManager;
|
|
use Alchemy\Phrasea\Model\Entities\User;
|
|
|
|
class LoadOneUser extends AbstractFixture implements FixtureInterface
|
|
{
|
|
/**
|
|
*
|
|
* @var User
|
|
*/
|
|
public $user;
|
|
|
|
public function load(ObjectManager $manager)
|
|
{
|
|
if (null === $this->user) {
|
|
throw new \Exception('Please set a user to persist');
|
|
}
|
|
|
|
$manager->persist($this->user);
|
|
$manager->flush();
|
|
|
|
$this->addReference('one-user', $this->user);
|
|
}
|
|
|
|
public function getUser()
|
|
{
|
|
return $this->user;
|
|
}
|
|
|
|
public function setUser(User $user)
|
|
{
|
|
$this->user = $user;
|
|
}
|
|
}
|