-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fixtures] [TO BE DELETED] Sample fixture
- Loading branch information
Showing
5 changed files
with
87 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,48 @@ | ||
<?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\Fixture; | ||
|
||
use Sylius\Bundle\FixturesBundle\Fixture\FixtureInterface; | ||
use Symfony\Component\Config\Definition\Builder\TreeBuilder; | ||
|
||
/** | ||
* @author Kamil Kokot <kamil.kokot@lakion.com> | ||
*/ | ||
final class SampleFixture implements FixtureInterface | ||
{ | ||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function getConfigTreeBuilder() | ||
{ | ||
$treeBuilder = new TreeBuilder(); | ||
$root = $treeBuilder->root('sample_fixture'); | ||
|
||
$root | ||
->children() | ||
->arrayNode('administrators') | ||
->prototype('scalar') | ||
; | ||
|
||
return $treeBuilder; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function load(array $options) | ||
{ | ||
foreach ($options['administrators'] as $administrator) { | ||
printf('Creating an admin account for "%s"' . "\n", $administrator); | ||
} | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/Sylius/Bundle/CoreBundle/Resources/config/app/fixtures.yml
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 @@ | ||
# This file is part of the Sylius package. | ||
# (c) Paweł Jędrzejewski | ||
|
||
sylius_fixtures: | ||
suites: | ||
sample_suite: | ||
fixtures: | ||
sample_fixture: | ||
priority: 10 | ||
options: | ||
administrators: | ||
- Zbigniew Hołdys | ||
- Krzysztof Krawczyk | ||
- Ryszard Rynkowski |
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,20 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<!-- | ||
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. | ||
--> | ||
|
||
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | ||
<services> | ||
<service id="sylius.fixture.sample" class="Sylius\Bundle\CoreBundle\Fixture\SampleFixture"> | ||
<tag name="sylius_fixtures.fixture" fixture-name="sample_fixture" /> | ||
</service> | ||
</services> | ||
</container> |
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