Commit ed71157a authored by Hermann Mayer's avatar Hermann Mayer

Cleanup configured fixtures and configs.

parent 40f859f7
jity_homepage:
search:
enable: true
admin:
email: admin@jity.de
impress:
site_admin:
name: Herman Mayer
......
<?php
namespace Jity\HomepageBundle\DataFixtures\ORM;
/*
* This file is part of the Jity package.
*
* (c) Hermann Mayer <hermann.mayer92@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Jity\HomepageBundle\Entity\Page;
namespace Jity\HomepageBundle\DataFixtures\ORM;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Jity\HomepageBundle\Entity\Page,
Doctrine\Common\Persistence\ObjectManager,
Doctrine\Common\DataFixtures\AbstractFixture,
Doctrine\Common\DataFixtures\OrderedFixtureInterface;
/**
* LoadPageData
* Load20HomePageData
*
* Load homepage fixtures.
*
* @uses AbstractFixture
* @uses OrderedFixtureInterface
* @version $id$
* @uses AbstractFixture
* @uses OrderedFixtureInterface
* @author Hermann Mayer <hermann.mayer92@gmail.com>
*/
class Load20HomePageData extends AbstractFixture implements OrderedFixtureInterface
......@@ -21,7 +30,10 @@ class Load20HomePageData extends AbstractFixture implements OrderedFixtureInterf
/**
* load
*
* @param ObjectManager $manager
* Load the fixtures.
*
* @param ObjectManager $manager ObjectManager Instance
*
* @access public
* @return void
*/
......@@ -88,16 +100,13 @@ ein Menü, mit dessen Hilfe man zum Login-Formular gelangt. Dort müssen die
angegebenen Zugangsdaten eingegeben werden.
</p>
<br><br>
')
<br><br>')
->setCategory($this->getReference('default-category'))
->setSidebar($this->getReference('default-sidebar'))
->setNavigation($this->getReference('default-navigation'))
->setAuthor($this->getReference('admin-user'))
->setService($this->getReference('homepage-service'))
->setIcon('icon-flag')
;
->setIcon('icon-flag');
/*
* --------------------------------------------------------------------
......@@ -115,6 +124,8 @@ angegebenen Zugangsdaten eingegeben werden.
/**
* getOrder
*
* Get the position (in order) of the fixture.
*
* @access public
* @return void
*/
......
<?php
namespace Jity\HomepageBundle\DataFixtures\ORM;
/*
* This file is part of the Jity package.
*
* (c) Hermann Mayer <hermann.mayer92@gmail.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Jity\HomepageBundle\Entity\User;
namespace Jity\HomepageBundle\DataFixtures\ORM;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Jity\HomepageBundle\Entity\User,
Doctrine\Common\Persistence\ObjectManager,
Doctrine\Common\DataFixtures\AbstractFixture,
Doctrine\Common\DataFixtures\OrderedFixtureInterface,
Symfony\Component\DependencyInjection\ContainerAwareInterface,
Symfony\Component\DependencyInjection\ContainerInterface;
/**
* LoadUserData
*
* @uses AbstractFixture
* @uses OrderedFixtureInterface
* @uses ContainerAwareInterface
* @version $id$
* @author Hermann Mayer <hermann.mayer92@gmail.com>
* Load02UserData
*
* Load user fixtures.
*
* @uses AbstractFixture
* @uses OrderedFixtureInterface
* @uses ContainerAwareInterface
* @author Hermann Mayer <hermann.mayer92@gmail.com>
*/
class Load02UserData extends AbstractFixture implements OrderedFixtureInterface, ContainerAwareInterface
{
private $container;
/**
* setContainer
*
* @param ContainerInterface $container
* setContainer
*
* Set the dependency injection container.
*
* @param ContainerInterface $container Dependency Injection Container
*
* @access public
* @return void
*/
......@@ -36,28 +48,37 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
}
/**
* encodePassword
*
* @param User $user
* encodePassword
*
* Encode a password with the symfony security encoder factory.
*
* @param User $user User to protect
*
* @access public
* @return void
* @return User
*/
public function encodePassword(User $user)
{
// Generate 'admin' Password
$encoder = $this->container->get('security.encoder_factory')->getEncoder(new User());
$encoder = $this->container
->get('security.encoder_factory')
->getEncoder(new User());
$user->setPassword(
$encoder->encodePassword(strtolower($user->getFirstName()), $user->getSalt())
$encoder->encodePassword(
strtolower($user->getFirstName()), $user->getSalt()
)
);
return $user;
}
/**
* load
*
* @param ObjectManager $manager
* load
*
* Load the fixtures.
*
* @param ObjectManager $manager ObjectManager Instance
*
* @access public
* @return void
*/
......@@ -67,7 +88,7 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
$config = (object) $this->container->getParameter('jity_homepage');
/*
* --------------------------------------------------------------------
* --------------------------------------------------------------------
*/
// Build Admin User
......@@ -75,14 +96,14 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
$admin
->setEmail($config->admin['email'])
->setFirstName('Admin')
->setLastName('')
->setLastName('Admin')
->setStatus(User::STATUS_ACTIVE)
->addGroup($this->getReference('admin-group'))
;
->addGroup($this->getReference('admin-group'));
$this->encodePassword($admin);
/*
* --------------------------------------------------------------------
* --------------------------------------------------------------------
*/
// Save all Metadata
......@@ -95,8 +116,10 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
}
/**
* getOrder
*
* getOrder
*
* Get the position (in order) of the fixture.
*
* @access public
* @return void
*/
......
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