Created
October 21, 2015 10:55
-
-
Save Etheriq/415e438295a4ae99d401 to your computer and use it in GitHub Desktop.
Example fixtures loader class
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
<?php | |
namespace AppBundle\DataFixtures\ORM; | |
use Hautelook\AliceBundle\Alice\DataFixtureLoader; | |
class FixturesLoader extends DataFixtureLoader | |
{ | |
/** | |
* Returns an array of file paths to fixtures | |
* | |
* @return array<string> | |
*/ | |
protected function getFixtures() | |
{ | |
$env = $this->container->get('kernel')->getEnvironment(); | |
if ($env == 'test') { | |
return [ | |
__DIR__ . '/DataForTests/tag.yml', | |
__DIR__ . '/DataForTests/categories.yml', | |
__DIR__ . '/DataForTests/user.yml', | |
]; | |
} | |
return [ | |
__DIR__ . '/Data/tag.yml', | |
__DIR__ . '/Data/categories.yml', | |
__DIR__ . '/Data/user.yml', | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment