* * 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 . */ 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 = [ 'social_action_info_conseil' => [ 'title' => [ 'fr' => 'Informer, conseiller' ], 'issue' => 'social_issue_prev_prot' ], 'social_action_instruire' => [ 'title' => [ 'fr' => 'Instruire l\'imprime unique pour des impayƩs' ], 'issue' => 'social_issue_prev_prot' ], 'social_action_MASP' => [ 'title' => [ 'fr' => 'MASP' ], 'issue' => 'social_issue_diff_fin' ], 'social_action_protection_enfant' => [ 'title' => [ '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('P5D')); $manager->persist($socialAction); $this->addReference($ref, $socialAction); print("Adding SocialAction '".$new['title']['fr']."'\n"); } $manager->flush(); } }