From 6adcdaa69af4eb0e1138080a08003b1c8a9b9d7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Thu, 14 Oct 2021 14:20:18 +0200 Subject: [PATCH] remove print in load fixtures --- .../DataFixtures/ORM/LoadActivity.php | 1 - .../DataFixtures/ORM/LoadCustomField.php | 45 +++++++++---------- .../DataFixtures/ORM/LoadReports.php | 12 +++-- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php index ce32143f5..a23b2d73f 100644 --- a/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php +++ b/src/Bundle/ChillActivityBundle/DataFixtures/ORM/LoadActivity.php @@ -141,7 +141,6 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C $ref = 'activity_'.$person->getFullnameCanonical(); for($i = 0; $i < $activityNbr; $i ++) { - print "Creating an activity type for : ".$person." (ref: ".$ref.") \n"; $activity = $this->newRandomActivity($person); $manager->persist($activity); } diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php index 005f7d9ec..a19537cc4 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadCustomField.php @@ -1,20 +1,20 @@ - * + * * 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 . */ @@ -35,11 +35,9 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface { return 15001; } - + public function load(ObjectManager $manager) { - echo "loading CustomField...\n"; - $cFTypes = [ array('type' => 'text', 'options' => array('maxLength' => '255')), array('type' => 'text', 'options' => array('maxLength' => '1000')), @@ -78,7 +76,6 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface ]; for($i=0; $i <= 25; $i++) { - echo "CustomField {$i}\n"; $cFType = $cFTypes[rand(0,sizeof($cFTypes) - 1)]; $customField = (new CustomField()) @@ -92,17 +89,17 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface $manager->persist($customField); } - + $this->createExpectedFields($manager); - + $manager->flush(); } - + private function createExpectedFields(ObjectManager $manager) { //report logement $reportLogement = $this->getReference('cf_group_report_logement'); - + $houseTitle = (new CustomField()) ->setSlug('house_title') ->setType('title') @@ -112,7 +109,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface ->setCustomFieldsGroup($reportLogement) ; $manager->persist($houseTitle); - + $hasLogement = (new CustomField()) ->setSlug('has_logement') ->setName(array('fr' => 'Logement actuel')) @@ -143,13 +140,13 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface 'active' => true ) ] - + )) ->setOrdering(20) ->setCustomFieldsGroup($reportLogement) ; $manager->persist($hasLogement); - + $descriptionLogement = (new CustomField()) ->setSlug('house-desc') ->setName(array('fr' => 'Plaintes éventuelles sur le logement')) @@ -159,11 +156,11 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface ->setCustomFieldsGroup($reportLogement) ; $manager->persist($descriptionLogement); - - + + //report problems $reportEducation = $this->getReference('cf_group_report_education'); - + $title = (new CustomField()) ->setSlug('title') ->setType('title') @@ -173,7 +170,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface ->setCustomFieldsGroup($reportEducation) ; $manager->persist($title); - + $educationLevel = (new CustomField()) ->setSlug('level') ->setName(array('fr' => 'Niveau du plus haut diplôme')) @@ -209,14 +206,14 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface 'active' => true ) ] - + )) ->setOrdering(20) ->setCustomFieldsGroup($reportEducation) ; $manager->persist($educationLevel); - - - + + + } -} \ No newline at end of file +} diff --git a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php index 5ef8939d8..31994c2e6 100644 --- a/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php +++ b/src/Bundle/ChillReportBundle/DataFixtures/ORM/LoadReports.php @@ -92,15 +92,19 @@ class LoadReports extends AbstractFixture implements OrderedFixtureInterface, Co ->findOneBy(array('firstName' => 'Charline', 'lastName' => 'DEPARDIEU')) ; - $report = (new Report()) + if (NULL !== $charline) { + $report = (new Report()) ->setPerson($charline) ->setCFGroup($this->getReference('cf_group_report_logement')) ->setDate(new \DateTime('2015-01-05')) ->setScope($this->getReference('scope_social')) - ; - $this->fillReport($report); + ; + $this->fillReport($report); - $manager->persist($report); + $manager->persist($report); + } else { + print("WARNING: Charline DEPARDIEU not found in database"); + } } /**