1. Go to this page and download the library: Download funddy/fixture-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
funddy / fixture-bundle example snippets
// ...
public function registerBundles()
{
$bundles = array(
// ...
new Funddy\Bundle\FixtureBundle\FunddyFixtureBundle()
// ...
);
// ...
}
namespace Acme\DemoBundle\Fixture;
use Acme\DemoBundle\Service\UserService;
use Funddy\Fixture\Fixture\Fixture;
class UserFixture extends Fixture
{
private $userService;
public function __construct(UserService $userService)
{
$this->userService = $userService;
}
public function load()
{
$user = $this->userService->create('[email protected]', 'Keyvan Akbary');
$this->addReference($user, 'user-keyvan');
}
public function getOrder() {
return 0;
}
}
namespace Acme\DemoBundle\Command;
use Funddy\Bundle\FixtureBundle\ConsoleFixtureLoader\ConsoleFixtureLoader;
use Funddy\Fixture\Fixture\FixtureLoader;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class FixturesLoadCommand extends ContainerAwareCommand
{
private static $fixtureServiceNames = array(
'acme.demobundle.fixture.userfixture'
);
protected function configure()
{
$this
->setName('acme:fixtures:load')
->setDescription('Load all fixtures');
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$fixtureLoader = new ConsoleFixtureLoader(new FixtureLoader(), $output);
$this->loadFixtureServicesIntoLoader($fixtureLoader);
$fixtureLoader->loadAll();
}
private function loadFixtureServicesIntoLoader($fixtureLoader)
{
foreach (self::$fixtureServiceNames as $fixtureServiceName) {
$fixtureLoader->addFixture($this->getContainer()->get($fixtureServiceName));
}
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.