mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
56 lines
1.8 KiB
PHP
56 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Chill\DocGeneratorBundle\DataFixtures\ORM;
|
|
|
|
use Doctrine\Common\DataFixtures\AbstractFixture;
|
|
use Doctrine\Persistence\ObjectManager;
|
|
use Doctrine\Common\DataFixtures\DependentFixtureInterface;
|
|
|
|
|
|
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
|
|
|
|
/**
|
|
* Load DocGeneratorTemplate
|
|
*
|
|
* @author Champs-Libres Coop
|
|
*/
|
|
class LoadDocGeneratorTemplate extends AbstractFixture
|
|
{
|
|
|
|
public function load(ObjectManager $manager)
|
|
{
|
|
$templates = [
|
|
[
|
|
'name' => ['fr' => 'FORMULAIRE AEB'],
|
|
'desc' => 'stocké sur openstack comedienbe',
|
|
'file' => 'FORMULAIRE_AEB.docx',
|
|
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
|
|
'entities' => ['Chill\PersonBundle\Entity\AccompanyingPeriod', 'Chill\PersonBundle\Entity\SocialWork\SocialAction'],
|
|
], [
|
|
'name' => ['fr' => 'AIDE ALIMENTAIRE'],
|
|
'desc' => 'stocké sur openstack comedienbe',
|
|
'file' => 'AIDE_ALIMENTAIRE.docx',
|
|
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
|
|
'entities' => ['Chill\PersonBundle\Entity\AccompanyingPeriod', 'Chill\PersonBundle\Entity\SocialWork\SocialAction'],
|
|
],
|
|
];
|
|
|
|
foreach ($templates as $template) {
|
|
|
|
print('Adding doc generator templates '.$template['file'].")\n");
|
|
|
|
$newTemplate = (new DocGeneratorTemplate())
|
|
->setName($template['name'])
|
|
->setDescription($template['desc'])
|
|
->setFile($template['file'])
|
|
->setContext($template['context'])
|
|
->setEntities($template['entities'])
|
|
;
|
|
|
|
$manager->persist($newTemplate);
|
|
|
|
$manager->flush();
|
|
}
|
|
}
|
|
}
|