66 lines
2.2 KiB
PHP

<?php
/**
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
/**
* Chill is a software for social workers.
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\DocGeneratorBundle\DataFixtures\ORM;
use Chill\DocGeneratorBundle\Entity\DocGeneratorTemplate;
use Chill\PersonBundle\Entity\AccompanyingPeriod\AccompanyingPeriodWorkEvaluation;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Persistence\ObjectManager;
/**
* Load DocGeneratorTemplate.
*/
class LoadDocGeneratorTemplate extends AbstractFixture
{
public function load(ObjectManager $manager)
{
$templates = [
[
'name' => ['fr' => 'FORMULAIRE AEB'],
'desc' => 'stocké sur openstack comedienbe',
'file' => 'FORMULAIRE_AEB_WITH_DATA_INJ.docx',
'context' => 'Chill\DocGeneratorBundle\Context\HouseholdMemberSelectionContext',
'entities' => [AccompanyingPeriodWorkEvaluation::class],
], [
'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', AccompanyingPeriodWorkEvaluation::class],
],
];
foreach ($templates as $template) {
echo '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();
}
}
}