mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
45 lines
1016 B
PHP
45 lines
1016 B
PHP
<?php
|
|
|
|
namespace Chill\PersonBundle\DataFixtures\ORM;
|
|
|
|
use Chill\PersonBundle\Service\Import\SocialWorkMetadata;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use League\Csv\Reader;
|
|
|
|
class LoadSocialWorkMetadata extends \Doctrine\Bundle\FixturesBundle\Fixture implements \Doctrine\Common\DataFixtures\OrderedFixtureInterface
|
|
{
|
|
private SocialWorkMetadata $importer;
|
|
|
|
/**
|
|
* @param SocialWorkMetadata $importer
|
|
*/
|
|
public function __construct(SocialWorkMetadata $importer)
|
|
{
|
|
$this->importer = $importer;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function load(ObjectManager $manager)
|
|
{
|
|
try {
|
|
$csv = Reader::createFromPath(__DIR__.'/data/social_work_metadata.csv');
|
|
} catch (Throwable $e) {
|
|
throw new Exception('Error while loading CSV.',0, $e);
|
|
}
|
|
|
|
$csv->setDelimiter(";");
|
|
|
|
$this->importer->import($csv);
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getOrder()
|
|
{
|
|
return 9500;
|
|
}
|
|
}
|