Add fixtures for social work

This commit is contained in:
Marc Ducobu
2021-05-11 18:22:41 +02:00
parent a63c38b6aa
commit eda454cb9d
4 changed files with 336 additions and 0 deletions

View File

@@ -0,0 +1,82 @@
<?php
/*
* Chill is a suite of a modules, Chill is a software for social workers
* Copyright (C) 2021, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace Chill\PersonBundle\DataFixtures\ORM;
use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
use Doctrine\Persistence\ObjectManager;
use Chill\PersonBundle\Entity\SocialWork\SocialAction;
/**
* Create social actions
*
*/
class LoadSocialActions extends AbstractFixture implements OrderedFixtureInterface
{
public function getOrder()
{
return 10020;
}
public static $socialActions = array(
'social_action_info_conseil' => array(
'title' => array(
'fr' => 'Informer, conseiller'
),
'issue' => 'social_issue_prev_prot'
),
'social_action_instruire' => array(
'title' => array(
'fr' => 'Instruire l\'imprime unique pour des impayés'
),
'issue' => 'social_issue_prev_prot'
),
'social_action_MASP' => array(
'title' => array(
'fr' => 'MASP'
),
'issue' => 'social_issue_diff_fin'
),
'social_action_protection_enfant' => array(
'title' => array(
'fr' => 'Protection Enfant confié dans le cadre judiciaire'
),
'issue' => 'social_issue_enfant_protection'
),
);
public function load(ObjectManager $manager)
{
foreach (static::$socialActions as $ref => $new) {
$socialAction = new SocialAction();
$socialAction->setTitle($new['title']);
$socialAction->setIssue($this->getReference($new['issue']));
$socialAction->setDefaultNotificationDelay(new \DateInterval('PT30M'));
$manager->persist($socialAction);
$this->addReference($ref, $socialAction);
print("Adding SocialAction '".$new['title']['fr']."'\n");
}
$manager->flush();
}
}