mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-05 07:19:49 +00:00
remove print in load fixtures
This commit is contained in:
parent
a96e5e25ce
commit
6adcdaa69a
@ -141,7 +141,6 @@ class LoadActivity extends AbstractFixture implements OrderedFixtureInterface, C
|
|||||||
$ref = 'activity_'.$person->getFullnameCanonical();
|
$ref = 'activity_'.$person->getFullnameCanonical();
|
||||||
|
|
||||||
for($i = 0; $i < $activityNbr; $i ++) {
|
for($i = 0; $i < $activityNbr; $i ++) {
|
||||||
print "Creating an activity type for : ".$person." (ref: ".$ref.") \n";
|
|
||||||
$activity = $this->newRandomActivity($person);
|
$activity = $this->newRandomActivity($person);
|
||||||
$manager->persist($activity);
|
$manager->persist($activity);
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Chill is a software for social workers
|
* Chill is a software for social workers
|
||||||
*
|
*
|
||||||
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
* Copyright (C) 2014, Champs Libres Cooperative SCRLFS, <http://www.champs-libres.coop>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU Affero General Public License as
|
* it under the terms of the GNU Affero General Public License as
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
* License, or (at your option) any later version.
|
* License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* 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/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
@ -35,11 +35,9 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
{
|
{
|
||||||
return 15001;
|
return 15001;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function load(ObjectManager $manager)
|
public function load(ObjectManager $manager)
|
||||||
{
|
{
|
||||||
echo "loading CustomField...\n";
|
|
||||||
|
|
||||||
$cFTypes = [
|
$cFTypes = [
|
||||||
array('type' => 'text', 'options' => array('maxLength' => '255')),
|
array('type' => 'text', 'options' => array('maxLength' => '255')),
|
||||||
array('type' => 'text', 'options' => array('maxLength' => '1000')),
|
array('type' => 'text', 'options' => array('maxLength' => '1000')),
|
||||||
@ -78,7 +76,6 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
for($i=0; $i <= 25; $i++) {
|
for($i=0; $i <= 25; $i++) {
|
||||||
echo "CustomField {$i}\n";
|
|
||||||
$cFType = $cFTypes[rand(0,sizeof($cFTypes) - 1)];
|
$cFType = $cFTypes[rand(0,sizeof($cFTypes) - 1)];
|
||||||
|
|
||||||
$customField = (new CustomField())
|
$customField = (new CustomField())
|
||||||
@ -92,17 +89,17 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
|
|
||||||
$manager->persist($customField);
|
$manager->persist($customField);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->createExpectedFields($manager);
|
$this->createExpectedFields($manager);
|
||||||
|
|
||||||
$manager->flush();
|
$manager->flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function createExpectedFields(ObjectManager $manager)
|
private function createExpectedFields(ObjectManager $manager)
|
||||||
{
|
{
|
||||||
//report logement
|
//report logement
|
||||||
$reportLogement = $this->getReference('cf_group_report_logement');
|
$reportLogement = $this->getReference('cf_group_report_logement');
|
||||||
|
|
||||||
$houseTitle = (new CustomField())
|
$houseTitle = (new CustomField())
|
||||||
->setSlug('house_title')
|
->setSlug('house_title')
|
||||||
->setType('title')
|
->setType('title')
|
||||||
@ -112,7 +109,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
->setCustomFieldsGroup($reportLogement)
|
->setCustomFieldsGroup($reportLogement)
|
||||||
;
|
;
|
||||||
$manager->persist($houseTitle);
|
$manager->persist($houseTitle);
|
||||||
|
|
||||||
$hasLogement = (new CustomField())
|
$hasLogement = (new CustomField())
|
||||||
->setSlug('has_logement')
|
->setSlug('has_logement')
|
||||||
->setName(array('fr' => 'Logement actuel'))
|
->setName(array('fr' => 'Logement actuel'))
|
||||||
@ -143,13 +140,13 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
'active' => true
|
'active' => true
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
))
|
))
|
||||||
->setOrdering(20)
|
->setOrdering(20)
|
||||||
->setCustomFieldsGroup($reportLogement)
|
->setCustomFieldsGroup($reportLogement)
|
||||||
;
|
;
|
||||||
$manager->persist($hasLogement);
|
$manager->persist($hasLogement);
|
||||||
|
|
||||||
$descriptionLogement = (new CustomField())
|
$descriptionLogement = (new CustomField())
|
||||||
->setSlug('house-desc')
|
->setSlug('house-desc')
|
||||||
->setName(array('fr' => 'Plaintes éventuelles sur le logement'))
|
->setName(array('fr' => 'Plaintes éventuelles sur le logement'))
|
||||||
@ -159,11 +156,11 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
->setCustomFieldsGroup($reportLogement)
|
->setCustomFieldsGroup($reportLogement)
|
||||||
;
|
;
|
||||||
$manager->persist($descriptionLogement);
|
$manager->persist($descriptionLogement);
|
||||||
|
|
||||||
|
|
||||||
//report problems
|
//report problems
|
||||||
$reportEducation = $this->getReference('cf_group_report_education');
|
$reportEducation = $this->getReference('cf_group_report_education');
|
||||||
|
|
||||||
$title = (new CustomField())
|
$title = (new CustomField())
|
||||||
->setSlug('title')
|
->setSlug('title')
|
||||||
->setType('title')
|
->setType('title')
|
||||||
@ -173,7 +170,7 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
->setCustomFieldsGroup($reportEducation)
|
->setCustomFieldsGroup($reportEducation)
|
||||||
;
|
;
|
||||||
$manager->persist($title);
|
$manager->persist($title);
|
||||||
|
|
||||||
$educationLevel = (new CustomField())
|
$educationLevel = (new CustomField())
|
||||||
->setSlug('level')
|
->setSlug('level')
|
||||||
->setName(array('fr' => 'Niveau du plus haut diplôme'))
|
->setName(array('fr' => 'Niveau du plus haut diplôme'))
|
||||||
@ -209,14 +206,14 @@ class LoadCustomField extends AbstractFixture implements OrderedFixtureInterface
|
|||||||
'active' => true
|
'active' => true
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
))
|
))
|
||||||
->setOrdering(20)
|
->setOrdering(20)
|
||||||
->setCustomFieldsGroup($reportEducation)
|
->setCustomFieldsGroup($reportEducation)
|
||||||
;
|
;
|
||||||
$manager->persist($educationLevel);
|
$manager->persist($educationLevel);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,15 +92,19 @@ class LoadReports extends AbstractFixture implements OrderedFixtureInterface, Co
|
|||||||
->findOneBy(array('firstName' => 'Charline', 'lastName' => 'DEPARDIEU'))
|
->findOneBy(array('firstName' => 'Charline', 'lastName' => 'DEPARDIEU'))
|
||||||
;
|
;
|
||||||
|
|
||||||
$report = (new Report())
|
if (NULL !== $charline) {
|
||||||
|
$report = (new Report())
|
||||||
->setPerson($charline)
|
->setPerson($charline)
|
||||||
->setCFGroup($this->getReference('cf_group_report_logement'))
|
->setCFGroup($this->getReference('cf_group_report_logement'))
|
||||||
->setDate(new \DateTime('2015-01-05'))
|
->setDate(new \DateTime('2015-01-05'))
|
||||||
->setScope($this->getReference('scope_social'))
|
->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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user